Forums Register Login

Exception in thread "main" NoClassDefFoundError

+Pie Number of slices to send: Send
Hello,
I think I am struggling with a known prob but I can't seems to figure it out.
I have a simple class and I am getting the above error when I try to run it from the command line.
when I try to run it from an IDE no problem.
public class Test {
public static void main(String [] args){
System.out.println("it works");
}
}
I set the classpath to the location of the class and also try to run the program using
# java -classpath . Test.class
if I echo the classpath I am getting to correct path
what am I doing wrong ?
thanks in advance
Shraga.
+Pie Number of slices to send: Send
Try:
java Test
+Pie Number of slices to send: Send
10x it works fine
Stupid me
+Pie Number of slices to send: Send
hi Shraga
Firstly, please edit your code to following which I recommand

And then save the file named
Test.java
Do you compile the programme once before run it?
if no,please do the following
javac Test.java
then run the programme
java Test
oo...
If you do the above state and can not run it,
Please feel free to let me know
thanks
Their achilles heel is the noogie! Give them noogies tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 707 times.
Similar Threads
Basic CLASSPATH problem on Mac OS X
Problem with package statement\
Problem with package statement
Import Statement
Running a class in a package
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:17:39.