The moose likes Beginning Java and the fly likes problem in classPath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem in classPath" Watch "problem in classPath" New topic

problem in classPath

gaurav abbi
Ranch Hand

Joined: Jan 05, 2007
Posts: 108
hi all,
my classpath is :

.;C:\Program Files\Java\jdk1.5.0_07lib\tools.jar;C:\ProgramFiles\Java\jdk1.5.0
_07\bin;C:\Program Files\Java\jre1.5.0_10\bin;C:\Program Files\Java\jre1.5.0_10\
gaurav\workBench\ONSStudio\Pythonfiles\JSGEN;C:\Program Files\Java\jre1.5.0_07;E

in the start only i've put java 1.5 references, but still it picks java 1.4 versions only and throws me errors for any java 1.5 features

any idea what else i need to do?

thanks,<br />gaurav abbi
John Dell'Oso
Ranch Hand

Joined: Apr 08, 2004
Posts: 130
The problem is not in your classpath - but most likely in your path environment variable. What is the value of your path?

Henry Wong

Joined: Sep 28, 2004
Posts: 18916

Another item to look for... if you are not running your Java program directly with the java command, but via a batch file, the classpath may be "initialized" by your batch file.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
gaurav abbi
Ranch Hand

Joined: Jan 05, 2007
Posts: 108
my path variable is

C:\Program Files\Java\jre1.5.0_07;C:\Program Files\Java\jre1.5.0_07\bin;C:\j2sdk
1.4.2_04\bin;E:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Progra
m C:\j2sdk1.4.2_04\bin;E:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin
;C:\Program Files\Oracle\jre\1.1.8\bin;C:\Python24;C:\WINDOWS\system32;C:\Progra
m Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Vi
sual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\T
ools;C:\Program Files\Microsoft Visual Studio\VC98\bin

and i'm running from command prompt only

java test
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 39478
I thought it was path not classpath when I saw your first post.
Your first JDK entry is for JDK 1.4; you need to enter your JDK 1.5.0 path in a similar format before the JDK 1.4 entry. Make sure the JDK entries end with \bin (Windows, I think /bin on Linux), and you would probably do well to delete the 1.4 entry.

When the computer looks for the entry "java" using the path as set up, the first one it finds is in your jdk1.4 installation; if you require Java 5 features, your application will crash.

Please check whether the jre entries ought to end with \bin too.

Hope this helps.

gaurav abbi
Ranch Hand

Joined: Jan 05, 2007
Posts: 108
hi all,
thanks for your replies, its working now..

but i've one doubt.
whats the difference b/w "classpath" and "path" variable.
marc weber

Joined: Aug 31, 2004
Posts: 11343

Originally posted by gaurav abbi:
...whats the difference b/w "classpath" and "path" variable.


"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
I agree. Here's the link: http://aspose.com/file-tools
subject: problem in classPath