This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Machine Learning with R: Expert techniques for predictive modeling and have Brett Lantz on-line!
See this thread for details.
Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

java -version

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Context:

JAVA_HOME= C:\Programmi\Java\jdk-1.5_16

If i launch the java -version under C:\Programmi\Java\jdk-1.5_16\bin
I have :
C:\Programmi\Java\jdk-1.5_16\bin>java -version
java version "1.5.0_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
Java HotSpot(TM) Client VM (build 1.5.0_15-b04, mixed mode)

With the java -version command launched somewhere I have:
C:\Sonic\testConsegna\BARI\SONIC-BIN\MQ7.5>java -version
CompilerOracle: exclude progress/message/broker/AgentQueueDispatcher$DispatchThr
ead.threadMain
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

Why the result 1.6 if instead in the java_home I have set 1.5?
Thanks Menen









 
Ranch Hand
Posts: 147
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because it actually looks in PATH and not JAVA_HOME, so I assume there's a reference to the 1.6 installation folder in PATH.
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say java -version in windows , it first looks for any java executable in the current directory.

If it does not find one, then it goes for PATH

As you have mentioned, you have tried java -version in the bin folders of 2 different versions of java. So, obviously you will get the version of the java executable in that particular folder.

Try java -version in any other folder and check.
 
Sandeep Sanaboyina
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, this is what happens in Linux and UNIX too.
 
Marshal
Posts: 65827
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sandeep Sanaboyina wrote:Also, this is what happens in Linux and UNIX too.

Are you sure about looking in the current directory as a default? I used not to be able to execute files in my current directory on Linux, until I added .: to my PATH.
 
Sheriff
Posts: 21805
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Windows adds an implicit . at the start of the PATH variable, Linux (or better: almost all Linux shells like bash, csh, etc) doesn't.
 
Campbell Ritchie
Marshal
Posts: 65827
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Rob. That explained it all.
 
Menen Zwerky
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I had to put the JAVA_HOME at the start of the path and now it does work fine
By Menen
 
Your mother was a hamster and your father was a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!