Results 1 to 13 of 13
Thread: Java error
- 10-23-2012, 10:49 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 7
- Rep Power
- 0
Java error
I made a file using notepad. Saved x.java. CMD>File directory>javac x.java. Two files came to my desktop x.class and x$.class. I typed "java x" in right directory and this error came:
And when I type " java x.class " it gives me this:Java Code:Exception in thread "main" java.lang.NoClassDefFoundError: guesscolor (wr e: GuessColor) at java.lang.ClassLoader.defineClass1(Nativ… Method) at java.lang.ClassLoader.defineClass(Unknow… Source) at java.security.SecureClassLoader.defineCl… Source) at java.net.URLClassLoader.defineClass(Unkn… Source) at java.net.URLClassLoader.access$100(Unkno… Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivile… Method) at java.net.URLClassLoader.findClass(Unknow… Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadCla… Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoad… Source)
So my question is, how can I fix those errors and make it run properly?Java Code:Error: Could not find or load main class x.class
- 10-23-2012, 10:55 PM #2
Re: Java error
probably the signature of the main() is wrong. can you show how your main() is declared?
- 10-23-2012, 10:57 PM #3
Member
- Join Date
- Oct 2012
- Posts
- 7
- Rep Power
- 0
Re: Java error
You mean that?
Java Code:public static void main(String[] args){ x c = new x(); c.start(); }
- 10-24-2012, 04:11 AM #4
Senior Member
- Join Date
- Oct 2012
- Posts
- 108
- Rep Power
- 0
Re: Java error
A) x is a bad class name. Java classes should be leading cap, and longer than one letter.
B) guesscolor and GuessColor are not the same class. NoClassDefFoundError is your culprit.
C) until the program compiles, it will not run with java.exe. Get the compiler errors to go away first. You may want to try an IDE (Eclipse, NetBeans, etc.) which can help you identify missing classes/bad name prior to compile time.
- 10-24-2012, 04:38 AM #5
Re: Java error
Please go through the Forum Rules -- particularly the third paragraph.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-24-2012, 06:05 AM #6
Member
- Join Date
- Oct 2012
- Posts
- 7
- Rep Power
- 0
Re: Java error
I tried to hide the name lol. It's guesscolor class. So how can I fix the problem(s)?
- 10-24-2012, 09:07 AM #7
Member
- Join Date
- Oct 2012
- Posts
- 7
- Rep Power
- 0
Re: Java error
Come on this is urgent :(
- 10-24-2012, 03:57 PM #8
Member
- Join Date
- Oct 2012
- Posts
- 7
- Rep Power
- 0
Re: Java error
I'm sorry, I shouldn't bump this much but this is really urgent. It has to be done in 2 hours :( I tried my parents, teacher and yahoo ask but still nothing. Please if you got anything to ask or you know the answer or anything please just post :l
- 10-24-2012, 05:33 PM #9
Re: Java error
Why do they call it rush hour when nothing moves? - Robin Williams
- 10-24-2012, 05:50 PM #10
Member
- Join Date
- Oct 2012
- Posts
- 7
- Rep Power
- 0
- 10-24-2012, 07:16 PM #11
- 10-24-2012, 08:40 PM #12
Senior Member
- Join Date
- Oct 2012
- Posts
- 108
- Rep Power
- 0
Re: Java error
Once again: guesscolor and GuessColor are NOT the same to the java compiler.
Using an IDE (Eclipse, NetBeans, etc.) will help you find these. Many IDEs for Java are free to download and use.
- 10-25-2012, 04:31 AM #13
Member
- Join Date
- Oct 2012
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
java.lang.NullpointerException error in tomcat 5.5 / http status 500 error
By rahil in forum Apache CommonsReplies: 3Last Post: 05-08-2012, 05:26 PM -
java out of memory error-heap space error
By elsanthosh in forum NetBeansReplies: 4Last Post: 06-15-2010, 09:31 AM -
Thread: Error 500--Internal Server Error java.lang.NullPointerException
By jackdear44 in forum New To JavaReplies: 1Last Post: 12-05-2009, 07:28 AM -
java.lang.Error: Error opening DSound for capture
By NARs in forum NetworkingReplies: 1Last Post: 10-26-2009, 04:38 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks