This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java -version" Watch "java -version" New topic

java -version

Paul O'Neill
Ranch Hand

Joined: Mar 13, 2007
Posts: 40
I have recently installed the same jre version (1.4.2_13) of Java on two servers. I let it create the default folder C:\Program Files\Java\j2re1.4.2_13. I've changed my path environment variable on both to point to this directory. When I type java -version, one server says it's build 1.4.2_13-b06 and the other says it's build 1.4.2-b28. I expect the first one but I've no idea where this b-28 is coming from. What am I missing?
Rob Spoor

Joined: Oct 27, 2005
Posts: 19649

When you install th JRE, it also puts the java.exe and javaw.exe files inside the Windows\System32 directory. As this directory is probably before your JRE home on the path, that one is taken.

1.4.2-b28 is a version of 1.4.2, without the _13. As the JRE installation usually overwrites these files, it seems that someone has installed an older JRE after you've installed JRE 1.4.2_13.

How To Ask Questions How To Answer Questions
Jan van Mansum
Ranch Hand

Joined: Oct 19, 2007
Posts: 74
Did you add "C:\Program Files\Java\j2re1.4.2_13" to your path or "C:\Program Files\Java\j2re1.4.2_13\bin"? (It should be the latter.)

Also, did you append or prepend it to your existing path? It may be that there are other versions of java installed that are found first.

In this thread someone had a similar problem with different java versions.
[ November 02, 2007: Message edited by: Jan van Mansum ]

SCJP 1.4, SCWCD 1.4
Paul O'Neill
Ranch Hand

Joined: Mar 13, 2007
Posts: 40
Here's my current path :

Path=C:\Program Files\Java\j2re1.4.2_13\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\
System32\Wbem;C:\Program Files\Resource Kit\;C:\NTRESKIT;C:\NTRESKIT\Perl;C:\Pro
gram Files\Common Files\Network Associates\VirusScan Engine\4.0.xx\;C:\Program F
iles\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\HP OpenView\Installed P
ackages\{790C06B4-844E-11D2-972B-080009EF8C2A}\bin;C:\Program Files\HP OpenView\
Installed Packages\{790C06B4-844E-11D2-972B-080009EF8C2A}\bin\OpC
Paul O'Neill
Ranch Hand

Joined: Mar 13, 2007
Posts: 40
Any suggestions on where to look? I see a patchjre file that refers to the b28 build but it's on all four servers. Only two of the servers have the issue.
Jan van Mansum
Ranch Hand

Joined: Oct 19, 2007
Posts: 74
Puzzling. Well, as a "sanity check" you could search your hard drive for "java.exe". If you right-click on each version in Explorer, click Properties, select the Version tab and then select "Full Version", you can check the exact version number of the executable.

Or you could just execute

<path to particular instance>\java.exe -version

for each java.exe you find.

I agree. Here's the link:
subject: java -version
Similar Threads
character set Cp037 is not supported
Unsupported major.minor version 50.0
Changing TimeZones - HEPL!!!
Eclipse 3.2 (WTP) : Error occuring while trying to debug
import java.util.Scanner issues