david_m_jacobson
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.
have you done a clean build of the project
ASKER
yes
Do you have all exactly the same paths on your new computer as on the old one?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Check
windows---->prefrences---> Java--->bulidpath and class path
windows---->prefrences--->
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
eclipse would tell you if they weren't
Did you create a new run configuration?
What class is it missing
ASKER
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
ASKER
I have not had a chance to test this yet.
ASKER
I had to uninstall my Java JDK and reinstall a 32-bit Java JDK.