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?
To export your project, right-click it and select Export. Select Java > Runnable JAR file as the export destination and click Next. On the next page, specify the name and path of the JAR file to create and select the Launch configuration that includes the project name and the name of the test class.
Try use the command jar -xvf fileName. jar and then do export the content of the decompressed file into a new Java project into Eclipse. Save this answer.
The error is caused because of a missing .class
file(s) for corresponding .java
file(s)
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
Another solution is to ensure that the Classpath is Valid
Also make sure that the permissions in your workspace folders are ok. I ran into this problem after updating Eclipse and then downloading some Maven dependencies.
In the end, what fixed it was doing a sudo chmod 777 -R workspace/MyProject
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With