Home > Back-end >  eclipse project/package/class path - how do I fix?
eclipse project/package/class path - how do I fix?

Time:09-17

I made a copy of a project, in eclipse, so I could make some dramatic changes and not impact the working code. Now when I try to execute the same code, that is working in the old project, in the new project, I get a NoCLassDefFoundError because it is pointing to the old project with the new class names (just added an a): java.lang.NoClassDefFoundError: cosc2425lab5fa21a/ArrayExamples at cosc2425lab5fa21/cosc2425lab5fa21testa.Lab5Test.main(Lab5Test.java:25)

I cannont spot how to fix the path so that this should now be: cosc2425lab5fa21a/cosc2425lab5fa21testa.Lab5Test.main

Notice I just added an a to the project name and package name and class names.

CodePudding user response:

I just refactored and renamed the classes. Not sure if there is a better way but it worked.

CodePudding user response:

If you save the project in computer it will change many names as all the previous project name are already there and even compiled .class file already inside the system.

And .class files name will be changed which will definitely give the NoClassDef FoundError, as during compilation the class is compiled and .class file is saved but at run time with the same class name it has only files of your previous project and the compiled .class files of this copied project have some different names so they are not even going to be noticed as the name is not the same as class name.

Changing all class names in the project can still make it run.

  • Related