File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main" ?please help

 
Elahe Shafie
Ranch Hand
Posts: 291
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
My application is so simple and it was working before I just rename the program and now when I want to run the program again, it gives me Exception in thread "main" and I can not figure out why? I didn't change any thing...
Hope to hear from you guys so soon.
Elahe
[error]
java.lang.NoClassDefFoundError: WEB-INF/classes/com/srs/bugtrack/DateTransfer (wrong name: com/srs/bugtrack/DateTransfer)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
Exception in thread "main"
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just rename the program

I didn't change any thing...

So which one is it? This is probably why you are getting this error. Or is your classpath correctly set?
Mark
 
Elahe Shafie
Ranch Hand
Posts: 291
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes the classpath is fine I just rename the program before renaming it was working...please help it is very critical for me...
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Name it back to what it was. I am saying, if all you changed was the name, then that is the problem.
Mark
 
Elahe Shafie
Ranch Hand
Posts: 291
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but even I created another application very simple it gives me same error message...any
idea
 
Elahe Shafie
Ranch Hand
Posts: 291
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so nothing to do with the rename the program
 
Elahe Shafie
Ranch Hand
Posts: 291
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the error is "NoClassDefFoundError"
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the error is "NoClassDefFoundError"

This error is becuase the JVM cannot find the class that you say to look for. Which is either a niming issue or a classpath issue.
classpath because it doesn't know where to look correctly, or naming because it is looking for one name, but you have it as a different name.
That's the best I can do for you. Hope it helps.
Mark
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As explained by Mark, your renaming the file means that you have a class file with the old name and a file called something else. Bottom line, the class name containing the main method and the file name must match.
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just checking, did you re-compile the program under the new name? If not, you don't have a class file with the new name for the JVM to find!
again, I'm just checking.
Jamie
[I think this is what Bosun was implying too]
[ May 21, 2002: Message edited by: Jamie Robertson ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic