Meaningless Drivel is fun!
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "java -version" Watch "java -version" New topic

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

Joined: Jul 08, 2003
Posts: 24199

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]
I agree. Here's the link:
subject: java -version
It's not a secret anymore!