Error creating runnable jar in eclipse

I have a project from which I want to make a Runnable Jar. I have a startup setup that works from Eclipse. When I try to export the Runnable Jar, I get this error for every .jar that uses the project: "Fat Jar Export: Could not find entry in class for"

Any ideas on what I need to do to make this work?

+4
source share
6 answers

You can make your JAR executable by providing the Main-Class in the META-INF / MANIFEST file. You will need to make sure that all of your dependencies are packaged in your JAR file or that you are using a "uber jar" style solution.

Cm:

0
source

is there another jar / library inside the jar of the file you are creating? I am

try going through a regular JAR wizard and add the mian class through the wizard. hope it works.

0
source

I managed to solve this problem by deleting the hidden .project and .classpath files, etc. created by eclipse in my project directory. And then closing the project and importing a new project.

It took me 2 days to solve this problem. But it works!

0
source

I had the same problem and the solution is pretty simple. Just right-click on your project, select PropertiesJava Build Path , then open the Libraries tab, click Add External JARs , and then select all the required libraries (those that received the error message, in my case it is derbyclient.jar), Confirm with OK . Then in the package explorer you will get Reference libraries , and there will be all additional libraries that need to be exported to an executable JAR file:

enter image description here

For unknown reasons, Eclipse will not add them automatically, even if you configured them correctly in Project → right-click → Run asRun configurationsClass track . You must manually add all the libraries you need, with Add External JARs

0
source

I was getting

Exception in thread "main" java.lang.NoClassDefFoundError: org/pmw/tinylog/writers/Writer at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56) Caused by: java.lang.ClassNotFoundException: org.pmw.tinylog.writers.Writer at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 3 more 

the solution for this is to right-click the project in eclipse, go to "Properties", then "Java Build Path", then "Order and Export" and enable "Project" and "External Dependencies" if it is disabled. Then export the runnable jar and it should contain any external libraries (you can check this because it has a larger size).

0
source

I had the same error message, but in a different situation, creating a running module jar in a project with several maven modules.

The solution was to right-click the project> Maven> update project> select all modules and click OK. This will update the eclipse dependencies to match the maven dependencies.

0
source

Source: https://habr.com/ru/post/1389449/


All Articles