wood burning stoves*
The moose likes Beginning Java and the fly likes java-execution only works if CLASSPATH is empty - why??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java-execution only works if CLASSPATH is empty - why???" Watch "java-execution only works if CLASSPATH is empty - why???" New topic
Author

java-execution only works if CLASSPATH is empty - why???

Robert Jaeger
Ranch Hand

Joined: Apr 29, 2002
Posts: 62
Hi!
This is a weired thing.
If I set
CLASSPATH j2sdk1.4.0_01\lib\tools.jar
the execution of test.class (which I successfully compiled from test.java) doesn�t work (The class cannot be found!)
If I leave the CLASSPATH empty, it works!!!
That is weired.
Unfortunately I want to add jdom.jar to my classpath, if I do that the execution of test.class doesn�t work anymore.
Another problem/question: Where do I have to put jdom.jar that it can be found? I put it in c:/j2sdk1.4.0_01/lib, but during compilation the packages that shoud be imported cannot be found.
Weired, too!
Someone can help me?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Set your classpath to the subdirectory that contains your class after you compiled it with javac.

So if you have a subdir like C:\java that contains MyClass.java and you compile it with

javac MyClass.java

then you now have C:\java\MyClass.java and C:\java\MyClass.class

Your classpath should include C:\java

You can add a jar file to C:\j2sdk1.4.0_01\jre\lib\ext


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java-execution only works if CLASSPATH is empty - why???