Note that there are some explanatory texts on larger screens.

plurals
  1. POEclipse doesn't recognize a jar I created with One-JAR
    primarykey
    data
    text
    <p>So I wrote one class with main method that depends on another jar file which dependes on many jar files. To make things simpler, I used One-JAR and created a single executable jar. The jar I created is fine, I was able to run it:</p> <pre><code>java -jar foo.jar </code></pre> <p>This executes my main application successfully. </p> <p>Next, I created a new project in Eclipse and added the foo.jar to the build path via the "add external jars" (I do it all the time and it always works). For some reason, in my Eclipse project it complains that it doesn't recognize the package import from foo.jar.</p> <p>I looked on previous questions on jar problems with Eclipse but none helped. I suspect it's something to do with the tree that One-Jar creates, but since "java -jar foo.jar" from the command line works fine, I don't understand why Eclipse doesn't see the class files.</p> <p>Thanks! </p> <p>Update: Here's how my foo.jar created by One-Jar looks like:</p> <pre><code>META-INF OneJar.class com doc lib main </code></pre> <p>inside main:</p> <pre><code>main main.jar </code></pre> <p>insides this main the package tree of my application with the .class files. Now, if I include "main.jar" in Eclipse, it does recognize my application. But then it doesn't recognize the other dependencies under lib/ so it throws run time exceptions. </p> <p>Update 2: So the problem with One-jar and Eclipse is not solved, but someone mentioned the fat jar Eclipse plugin so I tried it and it did the job perfectly. The jar it generated worked with both Eclipse and Maven. They actually support One-Jar as well, you can check the One-Jar option when creating the jar. I didn't use it but it's there (if it works it actually worth using because it should take care of library conflicts). Thanks for the help. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload