*
The moose likes Beginning Java 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java -version" Watch "java -version" New topic
Author

java -version

Paul O'Neill
Ranch Hand

Joined: Mar 13, 2007
Posts: 40
I haven't been active in Java in years so I forget EVERYTHING. I've downloaded the latest version to my PC but when I type 'java -version', I still see the old version. How do I change this? I changed my JAVA_HOME variable to point to my newly created folder.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
You've probably still got the location of the old JDK or JRE in your PATH. Modify that to make sure that either only the new JDK path is there or that it comes before the old ones if you can't get rid of them.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

As Keith suggested, the problem is probably your system PATH setting. The installation instructions should explain how to set this.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Paul O'Neill
Ranch Hand

Joined: Mar 13, 2007
Posts: 40
Thanks. I've looked at the instructions. How do you tell if you're using 64-bit Windows or just 32-bit Windows?
Glen Ihrig
Greenhorn

Joined: Mar 12, 2007
Posts: 8
Right click My Computer and select "Properties".
Select the "General" tab.

If the System name does not contain "x64" or "64 bit" then you are running 32 bit windows.

64 bit windows is a high performance, usually server, operating system although there is a Windows XP Professional 64 bit. You would probably know if you had this.
[ March 15, 2007: Message edited by: Glen Ihrig ]
Paul O'Neill
Ranch Hand

Joined: Mar 13, 2007
Posts: 40
I looked up the Installation Instructions but none of it seemed to apply. I tried re-setting my Path and now when I do 'java -version' it's gone back to 1.3. I've removed all earlier Java references by Add/Remove Programs. I've changed the classpath. What am I missing? Where does 'java -version' get its information from?

Paul
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
If you open a command prompt and type SET, that will display all of your environment variables.

See what your PATH is.
Paul O'Neill
Ranch Hand

Joined: Mar 13, 2007
Posts: 40
Now I feel foolish. I had changed my path but I had one of the numbers wrong. I've fixed it, rebooted, and now the correct version is showing up.

Thanks!
Paul O'Neill
Ranch Hand

Joined: Mar 13, 2007
Posts: 40
On another server I'm looking at, the only java reference in the path is to d:\IBMJDK\bin. Does this mean the java -version is coming from something in this directory? I need to update the version on this server, so I assume I need to download a new jre and save it into the d:\IBMJDK folder.

Firstly, is the bin directory the jre??

Thanks for everyone's help on what I imagine is basic stuff.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

"On another server I'm looking at, the only java reference in the path is to d:\IBMJDK\bin. Does this mean the java -version is coming from something in this directory?"

Most likely, yes. There could ofcourse be a java.exe in a different directory in the path (even a directory that is not obviously something that has to do with Java, such as C:\Windows\System32).

"I need to update the version on this server, so I assume I need to download a new jre and save it into the d:\IBMJDK folder."

Download the new version and follow the installation instructions - the instructions will tell you how you should install the new version and whether it is necessary to uninstall the old version first or not.

"Firstly, is the bin directory the jre??"

The JRE is part of the JDK. You can't really say "the bin directory is the JRE"; in the bin directory there are executables that are part of the JRE and there are executables (such as the Java compiler) that are part of the JDK.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java -version