Link to home
Start Free TrialLog in
Avatar of david_m_jacobson
david_m_jacobsonFlag for Afghanistan

asked on

NoClassDefFound error running Java application from Eclipse

I am setting up a new computer.  I copied my workspace directory from my old computer to my new computer.  I also copied my Eclipse directory from my old computer to my new computer.  When I run a Java class from Eclipse on my new computer I get a NoClassDefFound error for the class I am running.  When I do the same thing on the old computer it works fine.  I installed the Java SDK from scratch on the new computer.  I also have the new Java SDK in a different directory on my new computer than on my old computer.  I have also tried a bunch of ways to add the directory in which the class files are into the classpath.  I am putting the class files into the default "output" directory under the project's home directory.  This is the default value in Eclipse.  Do you have any suggestions?  I don't understand why Eclipse is not finding the class files.  I also verified that the class files exist under the output directory.
Avatar of Mick Barry
Mick Barry
Flag of Australia image

have you done a clean build of the project
Avatar of david_m_jacobson

ASKER

yes
Do you have all exactly the same paths on your new computer as on the old one?
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Check

windows---->prefrences---> Java--->bulidpath and class path
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I confirmed that all the jar files exist on the new computer.
> I confirmed that all the jar files exist on the new computer.

eclipse would tell you if they weren't

Did you create a new run configuration?
What class is it missing
I just chose "Run Configuration" from the Run menu and then clicked the "New" button and created a new configuration for the class I was trying to run.  There was no complaint about any missing classes.  I only get an error after I try to run the class.  That is when I get a NoClassDefFound error for the main method of the class I am trying to execute even though I have a main method.
what if u right click on the main class and select Run as>Java App
I have not had a chance to test this yet.
I had to uninstall my Java JDK and reinstall a 32-bit Java JDK.