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
posted
0
thrweth
Mohsin Shahzad
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
posted
0
the command line should be java -classpath . A Moving this to the Java in General (Beginner) forum.
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: 9033
10
posted
0
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