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 classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

classpath

vidhya subramaniam
Ranch Hand

Joined: Jul 14, 2001
Posts: 91
I am in my root directory /work/vsubra. I have file A.java in this directory. When I compile useing javac A.java it does create a class in the same dir as A.class. But when I run it using java A then it gives me this error
Exception in thread "main" java.lang.NoClassDefFound error
i have given the path in my classpath also for rt.jar. The path goes as
/usr/java131/jre/lib/rt.jar;.
Why this error then?
mohsin shahzad
Greenhorn

Joined: Dec 28, 2002
Posts: 6
thrweth


Mohsin Shahzad
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
the command line should be
java -classpath . A
Moving this to the Java in General (Beginner) forum.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2841
    
  11

You said it Mohsin!
It's also possible that the class A is declared to be in a package other than the default. Is there a line in A.java similar to:
package something;
?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Please do not cross-post. Thanks.
[ January 22, 2003: Message edited by: Marilyn de Queiroz ]

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: classpath
 
Similar Threads
JDK Installation Question
classpath.
Class Path and Path problem
Class path
Forte 3.0 for Linux PointBase question