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.
david_m_jacobsonAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
check your build path configuration
and make sure you're not using an old run configuration
0
 
objectsCommented:
have you done a clean build of the project
0
 
david_m_jacobsonAuthor Commented:
yes
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
for_yanCommented:
Do you have all exactly the same paths on your new computer as on the old one?
0
 
Sathish David Kumar NArchitectCommented:
Check

windows---->prefrences---> Java--->bulidpath and class path
0
 
CEHJConnect With a Mentor Commented:
>> 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.

That's a good start, but you also need to copy any dependencies too. If your project depends on foo.jar, then foo.jar must be present on the new system, and (unless you reconfigure the build path) it needs to be in exactly the same place in the file system.
0
 
david_m_jacobsonAuthor Commented:
I confirmed that all the jar files exist on the new computer.
0
 
objectsCommented:
> 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
0
 
david_m_jacobsonAuthor Commented:
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.
0
 
objectsCommented:
what if u right click on the main class and select Run as>Java App
0
 
david_m_jacobsonAuthor Commented:
I have not had a chance to test this yet.
0
 
david_m_jacobsonAuthor Commented:
I had to uninstall my Java JDK and reinstall a 32-bit Java JDK.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.