Eclipse导出jar文件以及JAR File和Runnable JAR File的区别
2017-07-19 21:24
302 查看
现在我写好了一个java项目,想要导出可执行的jar文件。有两种方法,具体如下。
I. Runnable JAR File
点击Eclipse左上角的“File”按钮,选择“Export”。
选择Java下的“Runnable JAR File”,点击“Next”。
直接”Finish”。
II. JAR File
File>Export。
选择Java下的“JAR File”,点击“Next”。
点击“Next”。
点击“Next”。
选择main函数的所在文件,点击”Finish”。
如何执行JAR?
在命令行通过java -jar <文件名>.jar可以运行;
如果没有图形界面,只能用命令行的方式运行;
如果你做了GUI,可以直接双击运行。
如果导出JAR File没有选择main函数会怎么样?
JAR File和Runnable JAR File的区别?
The runnable jar contains a MANIFEST.MF file, which defines the Main class to be executed when the jar is run. The “Main-Class” must be defined so the java runtime knows which class to call when the jar is “run.”
If a jar does not include a manifest with the “Main-Class:” it is not considered a “runnable jar” - it is just a library of Java code.
参考资料
https://stackoverflow.com/questions/4974693/java-eclipse-difference-between-exporting-as-a-jar-and-exporting-as-a-runnable
I. Runnable JAR File
点击Eclipse左上角的“File”按钮,选择“Export”。
选择Java下的“Runnable JAR File”,点击“Next”。
直接”Finish”。
II. JAR File
File>Export。
选择Java下的“JAR File”,点击“Next”。
点击“Next”。
点击“Next”。
选择main函数的所在文件,点击”Finish”。
如何执行JAR?
在命令行通过java -jar <文件名>.jar可以运行;
如果没有图形界面,只能用命令行的方式运行;
如果你做了GUI,可以直接双击运行。
如果导出JAR File没有选择main函数会怎么样?
JAR File和Runnable JAR File的区别?
The runnable jar contains a MANIFEST.MF file, which defines the Main class to be executed when the jar is run. The “Main-Class” must be defined so the java runtime knows which class to call when the jar is “run.”
If a jar does not include a manifest with the “Main-Class:” it is not considered a “runnable jar” - it is just a library of Java code.
参考资料
https://stackoverflow.com/questions/4974693/java-eclipse-difference-between-exporting-as-a-jar-and-exporting-as-a-runnable
相关文章推荐
- 关于java文件导出jar文件的问题,区别开 jar file 和 runnable jar file
- 【图文】Eclipse导出jar包过程【jar file与runnable jar file区别】
- eclipse 中的 jar file 和 runnable jar file的区别
- [转]eclipse 中的 jar file 和 runnable jar file的区别
- eclipse 中的 jar file 和 runnable jar file的区别
- eclipse 中的 jar file 和 runnable jar file的区别
- eclipse export jar file 和 runnable jar file 的区别
- eclipse 中的 jar file 和 runnable jar file的区别
- eclipse 中的 jar file 和 runnable jar file的区别
- 使用Eclipse将class打入jar包的时候,jar File 和Runnable jar file有什么区别?
- eclipse中jar file与runnable jar file的区别
- eclipse导出Runnable Jar File在Launch Configuration中找不到类
- eclipse 中的 jar file 和 runnable jar file的区别
- Eclipse导出Jar包 和 MANIFEST.MF文件
- java打包 eclipse 打包 runnable jar file,及运行jar包操作
- Eclipse导出可执行Java工程/可执行Jar文件(包含第三方Jar包)
- Eclipse导出可执行Java工程/可执行Jar文件(包含第三方Jar包)
- 解决eclipse中java项目导出成jar包后读写UTF-8文件中文乱码问题
- eclipse导出jar文件再将它转换成exe可执行文件详解
- Eclipse 导出jar文件异常总结