File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Exception in thread "main"  ?please help" Watch "Exception in thread "main"  ?please help" New topic
Author

Exception in thread "main" ?please help

Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
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"


Thanks,
Elahe
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
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

Joined: Feb 05, 2001
Posts: 17250
    
    6

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

Joined: Dec 12, 2001
Posts: 291
but even I created another application very simple it gives me same error message...any
idea
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
so nothing to do with the rename the program
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
the error is "NoClassDefFoundError"
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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

Joined: Nov 06, 2000
Posts: 1510
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.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

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.
 
subject: Exception in thread "main" ?please help