Computing.Net > Forums > Programming > Java Problems

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Java Problems

Reply to Message Icon

Name: dboy
Date: March 12, 2005 at 14:58:16 Pacific
OS: Windows ME
CPU/Ram: 800 Mhz/128 Mb
Comment:

hello.
I have problems with java.
every time i try to compile a java applet, I get The following message:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main

What does that mean? How can I fix it?

There are 3 types of people in this world, those who can count and those who can't.



Sponsored Link
Ads by Google

Response Number 1
Name: Dr. Nick
Date: March 12, 2005 at 16:25:25 Pacific
Reply:

Two things:

What commands are you using to compile and run it?

Try making your main method static if it's not already by saying public static void main(...)


0

Response Number 2
Name: dboy
Date: March 12, 2005 at 19:07:59 Pacific
Reply:

I am using the "javac" command.

This is a sample file that won't compile:

public class nine {
public void main() {
System.out.println("Hello!");
}
}

P.S. Nine is my favorite number. Hee Hee...

There are 3 types of people in this world, those who can count and those who can't.


0

Response Number 3
Name: Dr. Nick
Date: March 12, 2005 at 21:25:07 Pacific
Reply:

You must have missed my second suggestion.

Try putting the keyword static between public and void in your main method declaration.

Does that work?


0

Response Number 4
Name: dboy
Date: March 13, 2005 at 07:14:10 Pacific
Reply:

Nope. Same results.

There are 3 types of people in this world, those who can count and those who can't.


0

Response Number 5
Name: jlyon
Date: March 13, 2005 at 21:41:43 Pacific
Reply:

try:
public static void main(String args[])

also, I'm pretty sure your file must be named the same as the class containing your main method, in your case "nine.java".


0

Related Posts

See More



Response Number 6
Name: yuv
Date: March 22, 2005 at 01:08:33 Pacific
Reply:

hi dboy

frm error it seems that javac doesnt get the exact classfile.

i.e.

----- u might hav giving wrong name of file while compiling (consider CaseSensitivity also)
OR
----- c if clas name is same as file name.
OR
i am sure u might hav done this; still check with the Classpath variable. Javac shd find classfile in ur folder where ur .class file resides.

(offcourse follow standard syntax i.e public static void main(String args[] as in above comments )

hope things will work now...:)

----
yuv


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Java Problems

java problem www.computing.net/answers/programming/java-problem/11363.html

Java Problem www.computing.net/answers/programming/java-problem/7796.html

RealJ for Java (problem compiling) www.computing.net/answers/programming/realj-for-java-problem-compiling/1900.html