Different Java version showing on command line

前端 未结 4 1754
灰色年华
灰色年华 2021-02-07 07:31

I have recently checked on my Java version. I ran the command java -version and I found out that I was using java version 1.7.0_09. But when I tried to

4条回答
  •  悲哀的现实
    2021-02-07 08:02

    That AppData path in your comment isn't on your path (supposedly, anyway), so that's probably not what it's using. Unfortunately, there isn't a which command on Windows either.

    If you edit your path and move the C:\Program Files\Java\bin directory to the very beginning of the list and it still prints 1.7.0_09, then somehow you have JDK7u9 in your JDK7u7 folder. If not, browse to all the other directories on your path and open them 1-by-1 until you find the appropriate java file. Fortunately for you, your path is much shorter than mine.

    Note that when doing:

    > java -version
    

    It may also look for java.bat and other non-exe extensions, so keep an eye out for this while you're searching your path. Try running:

    > java.exe -version
    

    That way you know you're looking for an exe file.

    One last thing you can try:

    > "C:\Program Files\Java\jdk1.7.0_07\bin\java" -version
    

    If this returns 1.7.0_09, then something happened that updated your JDK in-place, which isn't supposed to happen, AFAIK (but I could be wrong).

提交回复
热议问题