Exception in thread "main" java.lang.NoClassDefFoundError: Main/class

Thread Solved

Join Date: Apr 2009
Posts: 7
Reputation: AMetnik is an unknown quantity at this point 
Solved Threads: 0
AMetnik AMetnik is offline Offline
Newbie Poster

Exception in thread "main" java.lang.NoClassDefFoundError: Main/class

 
0
  #1
Apr 30th, 2009
Ok, i have read alot about this bugs now, and nothing seems to help. Hope someone have a step by step solution for me, or atleast can give me some more insight hehe

Here is a few intel on my work.
Im working in netbeans on my labtop, uploading the .java files to an linux server, compiling, and running there.
.java and .class files are in same directory.
i have tried writing :
java -classpath . home/.../../../Main/Main
java -classpath . home/.../../../Main/Main.class

Here is my Error messages:
  1. dana@scylla:~/public_html/andersApplet/Main$ java Main.class
  2. Exception in thread "main" java.lang.NoClassDefFoundError: Main/class
  3. Caused by: java.lang.ClassNotFoundException: Main.class
  4. at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  5. at java.security.AccessController.doPrivileged(Native Method)
  6. at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  7. at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  8. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  9. at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  10. at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
  11. Could not find the main class: Main.class. Program will exit.

Here is my Code:
  1.  
  2. /**
  3.  *
  4.  * @author AndersM
  5.  */
  6. public class Main {
  7.  
  8. /**
  9.   * @param args the command line arguments
  10.   */
  11. public static void main(String[] args) {
  12. Board board = new Board();
  13. board.testthis();
  14. }
  15.  
  16. }
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,177
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 481
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Exception in thread "main" java.lang.NoClassDefFoundError: Main/class

 
0
  #2
Apr 30th, 2009
For the start Applet hasn't got main() method as you know from console or GUI applications. Have look at The Life Cycle of an Applet and here you can learn more on Applets if it is what you are after...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 7
Reputation: AMetnik is an unknown quantity at this point 
Solved Threads: 0
AMetnik AMetnik is offline Offline
Newbie Poster

Re: Exception in thread "main" java.lang.NoClassDefFoundError: Main/class

 
0
  #3
Apr 30th, 2009
i know, this is the server i am creating so i can get data from another server, since it would create policy errors if i tried to connect directly to another ip then the one i am loading the applet from thats what i have been told for sure? :-)
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 7
Reputation: AMetnik is an unknown quantity at this point 
Solved Threads: 0
AMetnik AMetnik is offline Offline
Newbie Poster

Re: Exception in thread "main" java.lang.NoClassDefFoundError: Main/class

 
0
  #4
May 2nd, 2009
noone to help?
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,427
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 507
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Weird java.lang.NoClassDefFoundError:

 
0
  #5
May 2nd, 2009
As you have it described, simply java Main should work just fine. You do not need to include the ".class" part. In fact, when the "java" command sees the ".", it assumes that is a package designation, which is why it is trying to find "Main/class".
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,177
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 481
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Exception in thread "main" java.lang.NoClassDefFoundError: Main/class

 
0
  #6
May 2nd, 2009
Originally Posted by AMetnik View Post
i know, this is the server i am creating so i can get data from another server, since it would create policy errors if i tried to connect directly to another ip then the one i am loading the applet from thats what i have been told for sure? :-)
Originally Posted by AMetnik View Post
noone to help?
I guess not because above is confusing statement. You creating server????
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 7
Reputation: AMetnik is an unknown quantity at this point 
Solved Threads: 0
AMetnik AMetnik is offline Offline
Newbie Poster

Re: Exception in thread "main" java.lang.NoClassDefFoundError: Main/class

 
0
  #7
May 2nd, 2009
Originally Posted by peter_budo View Post
I guess not because above is confusing statement. You creating server????
i am creating a connectiong from the applet to the server, and i am making that program which should run on the server right now.
does that clarify it abit?
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 7
Reputation: AMetnik is an unknown quantity at this point 
Solved Threads: 0
AMetnik AMetnik is offline Offline
Newbie Poster

Re: Weird java.lang.NoClassDefFoundError:

 
0
  #8
May 2nd, 2009
Thanks man, cant believe it to be that simple, but so far it looks to be solved thanks alot.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,177
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 481
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Exception in thread "main" java.lang.NoClassDefFoundError: Main/class

 
0
  #9
May 2nd, 2009
But then we are back to beginning where I said there is no main() method in applet.
Secondly what sort of connection from applet to server? What sort of server (database, web or application server)
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,177
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 481
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Weird java.lang.NoClassDefFoundError:

 
0
  #10
May 2nd, 2009
Ezzaral, AMetnik already made one post in regards of above issue yesterday, claiming above code is part of Applet (see here). Now this is creating confusion...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC