Cannot use Java 7 installation if Java 8 is installed

后端 未结 6 1184
野的像风
野的像风 2021-02-09 23:27

I normally still use Java 7 for all my coding projects (it\'s a company \"politics\" issue), but I installed Java 8 for one third-party project I am contributing to. Now, it see

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-09 23:40

    Looks like you have to check where in your PATH is located your JAVA_HOME variable, the PATH is evaluated from left to right. A tip for you is to do all your Java system variables configuration at the beginning of your PATH.

    PATH = %M2_HOME%\bin;%JAVA_HOME%\bin;C:\ProgramData\Oracle\Java\javapath;...
    

    Probably that's why after doing this:

    - java -version
    

    you are getting this:

    - java version "1.8.0_05"
    

    because there are other areas in your PATH that are pointing to other java.exe, for example C:\Windows\System32 or C:\ProgramData\Oracle\Java\javapath etc.

提交回复
热议问题