Java Eclipse: Difference between exporting as a JAR and exporting as a Runnable JAR

前端 未结 4 1123
旧巷少年郎
旧巷少年郎 2020-12-12 16:03

What is the difference in eclipse between exporting as a JAR file and exporting as a Runnable JAR file? Aren\'t they both runnable? What are the pros/cons of each?

4条回答
  •  隐瞒了意图╮
    2020-12-12 16:38

    The runnable 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 reused (it also contains the manifest file, but no main class there)

提交回复
热议问题