Cann't execute java program?
I am JUST STARTING to try out some java, and I can "javac .java" and it works fine. However, when I then try to "java " it gives me the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: Welcome1
Here is the code of the file:
public class Welcome1 {
public static void main(String args[]) {
System.out.println("Welcome test.");
}
}
All help is appreciated...
P.S. The file Welcome1.class and Welcome1.java are in the bin folder, which is of course the same directory of the JAVA and JAVAC.
SonicMailer Pro
The best mailing list manager has just gotten better!
Click here for a full list of features!
wheaties_box posted this at 12:46 — 16th September 2003.
They have: 20 posts
Joined: Sep 2003
well it looks as though everything is alright...just checked it on my box and it compiles and executes perfectly.
This is exactly what I did:
1. Highlight your code and copy/paste into editor
2. Save file as Welcome1.java (I assume from your PS that you already know the .java file MUST be named the same, case-sensitive and everything, as the [main] class defined in that file)
3. Typed `javac Welcome1.java` -- no errors came up
4. Typed `java Welcome1` -- no errors came up, just 'Welcome test.'
This shouldn't make a difference since we're talking about Java here, but are you on Linux or Windows?
Cold.....so..cold!!!
KandieMan101 posted this at 19:27 — 16th September 2003.
They have: 140 posts
Joined: Jan 2003
I seemed to have gotten it working... thanks though
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.