本文实例讲述了linux环境下java程序打包成简单的hello world输出jar包。分享给大家供大家参考,具体如下:
1。linux必须已安装java环境,测试,,
# javac - version javac 1.8.0_20 >之前说明java环境已安装好了
2。建立目录helloworld,在目录下建立helloworld.java文件
# cd ~ ~ # mkdir helloworld ~ # cd helloworld ~/helloworld # vi helloworld.java >之前helloworld。java内容如下
公开课helloworld { 公共静态void main (String [] args) { system . out。println (“Hello World !”); } } >之前把helloworld。java打包成可执行的jar
~/helloworld # javac helloworld.java ~/helloworld # ls ~/helloworld #回波主类:helloworld祝辞manifest.txt ~/helloworld # ls ~/helloworld #猫manifest.txt ~/helloworld #罐cvfm你好。jar清单。txt helloworld.class >之前屏幕显示如下打包信息:
运行hello.jar文件
~/helloworld # ls ~/helloworld # java jar hello.jar 你好世界! ! >之前更多关于java相关内容感兴趣的读者可查看本站专题:《java字符与字符串操作技巧总结》,《java数组操作技巧总结》,《java数学运算技巧总结》,《java数据结构与算法教程》及《java操作DOM节点技巧总结》
希望本文所述对大家java程序设计有所帮助。
linux环境下java程序打包成简单的hello world输出jar包示例