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
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.
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
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 )
Summary: Hi! I am trying to solve a java problem. I have solved the problem, but just some thing does not work. I am trying to find n , and this ( n x n) must be greater then a number(nbr). EX: nbr=100; ...
Summary: Hey I'm trying to use CodeWarrior to write some Java programs. I get the error: Link Error : Could not initialize Java VM. Make sure the JDK is installed properly. What is the problem? Should I dow...
Summary: Anyone have RealJ for Java? When I load a java source file and go to the build drop-down and try to click compile, it won't let me. The compile option is gray. Anyone had this problem? ...