Zahachos Zahachos - 1 month ago 8
Java Question

Unable to export any of my projects into a .jar file

Everytime I try to export any of the projects from my workspace into a Java jar file, I end up with an error:


JAR creation failed. See details for additional information.
Class files on classpath not found or not accessible for: 'Server Manager/src/me/Zahach/ServerManager/main.java'


And this error is repeated for every class in my project.

I tried reinstalling Eclipse, that didn't work.
I then tried to recreate a project and drag and drop my packages into it, that didn't work either.

What is going on?

Answer

The error is caused because of a missing .class file(s) for corresponding .java file(s)

  1. In Eclipse

    Goto Project->Clean and Rebuild the Project and then try exporting,
    If it doesn't work then make sure .class file exists in the bin folder for main.java file in your case

  2. Another solution is to ensure that the Classpath is Valid

Comments