permaculture playing cards*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem in classPath" Watch "problem in classPath" New topic
Author

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\
lib;C:\j2sdk1.4.2_04;C:\j2sdk1.4.2_04\jre\lib;C:\j2sdk1.4.2_04\jre\lib\comm.jar;
C:\j2sdk1.4.2_04\bin;D:\gaurav\workBench\ONSStudio;D:\gaurav\workBench\ONSStudio
\Installer\jdom.jar;D:\gaurav\workBench\ONSStudio\Installer\jdom-contrib.jar;D:\
gaurav\workBench\ONSStudio\Pythonfiles\JSGEN;C:\Program Files\Java\jre1.5.0_07;E
:\gaurav\j2ee\apache-tomcat-5.5.20\common\lib\servlet-api.jar

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?

Regards,
JD
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18120
    
  39

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.

Henry


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

Joined: Jan 05, 2007
Posts: 108
hi,
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
Sheriff

Joined: Oct 13, 2005
Posts: 36514
    
  16
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.

CR
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
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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

See PATH and CLASSPATH.


"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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem in classPath
 
Similar Threads
How do i get Java working?
Still not Working
Need Advice on Advice Application
I can compile but can't run
Problem in rmic - stub generation