Difference between Exporting as s JAR and Exporting as a Runnable JAR

The runnabel JAR contains a MANIFEST.MF file, which defines the Main class to be executed when the JAR is run.

Non-runnable JARs are just libraries of classes, that can be added to the classpath so that code is reuable. (It also contains the manifest file, but no main classes there).

 

On how to export a JAR file or a runnable JAR file please check the link below:

http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-37.htm

 

Example on how to export a runnable JAR file:

  1. Right Click on the project, and click on Export
  2. Select Runnable JAR file under Java, and click Next
  3. set Lauch configurations to the class which contains the Main function;
    set Export destination; and click Finish

You can check the JAR file with 7-zip, and the MANIFEST.MF file under META-INF folder.

It contains the class path to Main function while executing the JAR file.

Manifest-Version: 1.0
Class-Path: .
Main-Class: org.eclipse.jetty.embedded.FileServer

 

posted on 2016-11-07 11:04  周星的Blog  阅读(574)  评论(0编辑  收藏  举报

导航