How to Create JARs with Eclipse
Eclipse can create JARs using the 'Export' function. As of version 3.5, it supports two export destinations.
Plain JAR files can be created using the 'JAR file' export destination. It contains all the basic function provided by the JAR tool, and also allows you to create a simple manifest with Main-Class and Sealed attributes.
The 'Runnable JAR file' export destination is a great way to create executable JARs. Eclipse 3.5 offers three ways to handle library dependencies (see also 'How to Add Libraries to a JAR' above):
- Extract required libraries unpacks the library JARs and puts them into the JAR. This corresponds to solution 2 in the Libraries How-To. The result is a single JAR. Some libraries may not work when extracted with this method.
- Package required libraries puts the JARs unmodified into the executable, and adds some special startup code. It configures its own class as Main-Class in the manifest, which will then install a special classloader for the included JARs and start your own main class. This should work more reliable than the previous option (you still have to test it though).
- Copy required libraries into a sub-folder uses the Class-Path attribute as described in solution 1 of the Libraries How-To. This will work best, but results in more than one JAR.
If your program does not depend on any libraries, chose the first option.

