Skip to content Skip to sidebar Skip to footer

How To Do Eclipse's "export Jar" From The Command Line

In my workflow for creating a jar to distribute my code, I currently: right-click on my project in Eclipse select 'Export' select 'JAR file' uncheck the top-level files like .clas

Solution 1:

To manually create a jar file, you can use the "jar" utility. A jar file is basically an archive file (in fact, you can use any zip tool to extract the jar contents). To create a jar file, you specify the "c" option and all the .class files that you compiled and that you want included. The jar command-line mimics the tar command. So, for example, to add your class files whose root folder is com, you type:

  jar cf test.jar com

Optionally, you can add manifest data in the form of a manifest file to specify a default executable and other information.

However, a simpler way to build a jar file is to just use ant.

Checkout this tutorial from the ant website, which gives an example of a typical ant build file: http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html

Post a Comment for "How To Do Eclipse's "export Jar" From The Command Line"