linux环境下java程序打包成简单的hello world输出jar包示例
本文实例讲述了linux环境下java程序打包成简单的helloworld输出jar包。分享给大家供大家参考,具体如下:
1.linux必须已安装java环境,测试
#javac-version javac1.8.0_20
说明java环境已安装好了
2.建立目录helloworld,在目录下建立helloworld.java文件
#cd~ ~#mkdirhelloworld ~#cdhelloworld ~/helloworld#vihelloworld.java
helloworld.java内容如下
publicclasshelloworld{ publicstaticvoidmain(String[]args){ System.out.println("HelloWorld!!"); } }
把helloworld.java打包成可执行的jar
~/helloworld#javachelloworld.java ~/helloworld#ls ~/helloworld#echoMain-class:helloworld>manifest.txt ~/helloworld#ls ~/helloworld#catmanifest.txt ~/helloworld#jarcvfmhello.jarmanifest.txthelloworld.class
屏幕显示如下打包信息:
运行hello.jar文件
~/helloworld#ls ~/helloworld#java-jarhello.jar helloworld!!
更多关于java相关内容感兴趣的读者可查看本站专题:《Java字符与字符串操作技巧总结》、《Java数组操作技巧总结》、《Java数学运算技巧总结》、《Java数据结构与算法教程》及《Java操作DOM节点技巧总结》
希望本文所述对大家java程序设计有所帮助。
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。