I use Eclipse Helios 3.2.2. I have a stand alone Java application that needs to be run from a batch file. So I need to export it as a JAR. The program uses some other JAR files such as log4j.jar, javamail.jar and 2 more. When I run the app in Eclipse, there are no issues. But when I export it as a JAR and try to run, I get a "NoclassDeffound error". The external JARs don't get exported in this version of Eclipse. Elsewhere, I read that FatJar or WinRun4J plugins can be used. When I try to install these plugins I get an error that the site is not found. Is there some other source for these plugins, or is there some other way to export in this version of Eclipse?
Asked
Active
Viewed 7,882 times
1
-
Have you tried exporting as a runnable JAR file ? Also, see this duplicate question: [Eclipse Java; export jar, include referenced libraries, without fatjar](http://stackoverflow.com/q/528007/851811) – Xavi López May 14 '12 at 14:53
-
I saw this post you mention, but I dont think, I can use a new version of eclipse now. Also I dont know any Ant or Maven, its just a stand alone, not a Web project. So I was just hoping to have a JAR by using some option of Eclipse. – Raghu May 14 '12 at 15:00
-
By the way, Eclipse Helios is 3.6. Are you using Helios, or 3.2.2(Callisto) ? The Export Runnable JAR File should be available for Helios. – Xavi López May 14 '12 at 15:06
-
Its version 3.2.2...then not Helios – Raghu May 14 '12 at 15:08
1 Answers
5
If you're using Eclipse 3.4 or greater, use the Runnable JAR file export option.
Export all resources required to run an application into a JAR file on the local file system.
If you're using Eclipse 3.3 or lower, use an external plugin, for instance FatJar. Just follow the installation instructions and a simple tutorial on how to use it.

Xavi López
- 27,550
- 11
- 97
- 161
-
I am using Eclipse Helios 3.2.2. This version does not seem to have the Export --> to runnable JAR feature. I can export only to a JAR file? – Raghu May 14 '12 at 15:07
-
Then, you can achieve what you want with a plugin like, for instance, FatJAR. See the edit in my answer. – Xavi López May 14 '12 at 15:12
-
I unzipped FatJar and put it in the plugins folder(extracted folder which is net.sf.fjep.fatjar_0.0.31). I started the eclipse from command line as eclipse -clean. I still cannot export all the referenced libraries. Am I missing something? – Raghu May 14 '12 at 15:32
-
-