File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Setting path for Java 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 "Setting path for Java" Watch "Setting path for Java" New topic
Author

Setting path for Java

rj jn
Greenhorn

Joined: Dec 08, 2008
Posts: 2
Hi all,

I have installed JDK 1.5 in my computer. But when i check the version of java in command prompt it shows as java 4.

C:\>java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)


I have also given the classpath in environment variables.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Hi "Rj jn",
Welcome to the ranch. We are happy to have you here

On the way in, it seems you have missed out on our naming policy. Could you please adjust your screen name to comply to the same?

Coming back to your question.
Can you check your "path" settings and tell us which java/bin is in the path?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

C:\>java -version

Windows will use the PATH environment variable, and check in each directory if it can find "java.exe". Be careful that if you have two JDK's bin directory set in your PATH, only the first one in the PATH will be used.
So, at the prompt, type "set", and check your PATH. Make sure that your JDK5's bin directory is there, before any other.


[My Blog]
All roads lead to JavaRanch
Rupesh Bonthala
Greenhorn

Joined: Mar 08, 2007
Posts: 5
Hi,
type this on the command prompt.

set path=<jdk home of java5>\bin;%path%
now if you type java -version,the java5 version will be used.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Originally posted by Rupesh Bonthala:
Hi,
type this on the command prompt.

set path=<jdk home of java5>\bin;%path%
now if you type java -version,the java5 version will be used.


True, but after closing the command prompt, the path settings will be lost.
Puneet Mittal
Ranch Hand

Joined: Dec 18, 2007
Posts: 45

hi welcome to java ranch. you can check the PATH environment variable defined in your system, if it has any variable related with jdk1.4 than delete it and define a new setting with the new jdk1.5 installed path. and also if you have two jdk's installed on your system, then delete the previous one ohterwise you will be in trouble sometimes......
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Setting the PATH under Windows is explained here.
 
 
subject: Setting path for Java
 
Similar Threads
How to check, TOMCAT is running as welcome page not coming
Setting path for Java
Help File Focus Issue
Unsupported major.minor version 49.0
installing java on linux