Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Windows path and jdk version  RSS feed

 
Jinny Morris
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've installed jdk 1.8.0_77. But when I run the cmd prompt in Windows I get this:

C:\>java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) Client VM (build 25.77-b03, mixed mode, sharing)

C:\>javac -version
javac 1.7.0_07

I don't understand why the "compiler" version given is not the version that I just installed, and suspect that this is why I cannot compile or run from the command window. Does anyone know what I did wrong, or what I should do now?

Thank you!
 
Junilu Lacar
Sheriff
Posts: 11146
160
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set the JAVA_HOME environment variable and make sure that %JAVA_HOME℅\bin is one of the first things in your PATH.

Setting environment variables in Windows
 
Jinny Morris
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you thank you thank you!
 
Campbell Ritchie
Marshal
Posts: 55722
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The OS goes through the PATH from left to right. If it finds a java or javac installations, it uses the first one found and stops looking. Oddly enough if such a problem occurs, it is usually the other way round, that the java version is older than the javac version.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!