Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Windows path and jdk version

 
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!
 
Sheriff
Posts: 13549
223
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • 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!
 
Marshal
Posts: 65005
246
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!