wood burning stoves 2.0*
The moose likes Java in General and the fly likes java -version Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java -version" Watch "java -version" New topic
Author

java -version

leo donahue
Ranch Hand

Joined: Apr 17, 2003
Posts: 327
Is it safe to assume that if you have two different jdk's installed (thanks to Oracle) that when you issue a command such as:
java -version
at the DOS prompt, that the first jdk referenced in the classpath will be the one which is used?
Oracle installed jdk 1.3.1 at the beginning of my classpath variable and this is why I'm assuming I get 1.3.1 when I issue java -version
Which by the way the jdk 1.3.1 doesn't even show up in my control panel under Add/Remove programs. What's up with that?


Thanks, leo
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

java -version will run whichever is first in your PATH, not your CLASSPATH -- the latter will be used by whichever JDK Windows chooses to execute, but it's up to Windows to choose one (and it will use PATH to do so.)
Regarding the add/remove: it's perfectly possible to simply copy the JDK files onto a computer where they'll work fine, without having made any registry entries, so they won't show up in add/remove.


[Jess in Action][AskingGoodQuestions]
 
 
subject: java -version
 
Similar Threads
Uninstalling java on linux
Cant use java to execute files
Determine which jdk version for tomcat
MQJMS1046: The character set Cp437 is not supported
showing wrong jre