Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java CLASSPATH in XP

Status
Not open for further replies.

Almarton

Programmer
Jan 1, 2002
42
BR
Hi all,

I found weird how Windows XP deals with CLASSPATH, does it
happens normally or just with me?

The problem is that despite I had declared (CLASSPATH, PATH, JAVA_HOME) in my "Enviroment variables" (look below) when I run the command prompt (cmd.exe) it does not run the classes straight, it says:

"Exception in thread "main" java.lang.NoClassDefFoundError:"

Then I need to run with: java -cp %CLASSPATH% .... and it runs. Shouldn't the system recover the CLASSPATH automatically? Strange when I go into command prompt and press set it reports the PATH, CLASSPATH just as declared...

Does it happen with you all, if not do you think my
enviroment variables are to large to the memory?

Another weird thing is that in my opinion, should be enough to declare in the classpath only the folders where the .jar libraries were and not declaring each .jar file... the JVM should scan them for the libraries automatically, but it does not happens!!
Look how I have to set my PATH and CLASSPATH for it to find them as example:

CLASSPATH=.;C:\j2sdk140\lib\;C:\j2sdk140\lib\tools.jar;C:\j2sdk140\lib\servlet.jar;C:\j2sdk140\lib\jspengine.jar;C:\Program Files\JavaSoft\JRE\1.3.1\lib\ext\QTJava.zip;C:\j2sdk140\lib\xt.jar;C:\j2sdk140\lib\sax.jar;C:\j2sdk140\lib\dom4j.jar;C:\j2sdk140\lib\xt.jar;C:\j2sdk140\lib\xp.jar;C:\j2sdk140\lib\saxon.jar;

PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\j2sdk140\bin;c:\j2sdk140\lib;c:\jswdk101;c:\jswdk101\lib;C:\PROGRA~1\COMMON~1\AUTODE~1;D:\PROGRA~2\BC5\BIN;

Don't you find it strange? Is it my mistake?

What can I do to avoid to type -cp %CLASSPATH% everytime
when running apps from XP command prompt (cmd.exe)??

Many Thanks
Al.



Alexandre @lmarton Marton
almarton@task.com.br
 
All I did was add this to my path in both user and system variables and it works fine for me:
C:\jdk1.3.1_01\bin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top