在Linux系统上部署Java项目 [英] Deploying a Java project on Linux system
问题描述
我使用Java开发了一个项目,现在我必须将其交付给使用Linux的客户。
I developed a project using Java and now I've to deliver it to client who is using Linux. Which executable file format will be delivered and how to make that?
推荐答案
基本上,您想在.sh文件中放入什么内容?您通常在控制台上键入的命令以运行jar文件。它们应该用换行符分隔(即,.sh文件中的每行都分开)。
Well basically what you wanna put in a .sh file is the commands you'd normally type at the console to run your jar file. They should be separated by a new line (i.e. each on a separate line in the .sh file).
最基本的方法是在您的计算机中添加类似的内容sh文件:
The most basic you can go is add something like this to your sh file:
java -Xms=64m -Xmx=256m -jar myJar.jar -classpath [dependencies dir]/dep1.jar,[dependencies dir]/dep2.jar
除此之外,您还可以做更多奇特的事情,例如参数化一些环境变量,从.sh启动时获取命令行参数,并将其传递给jar可执行文件等。查找 bash脚本以获取高级信息:
beyond this you can do more exotic stuff, like parametrise some environment variables, get command line argumens from when the .sh is launched and pass them to the jar executatble etc. Look up "bash scripting" for advanced stuff:
< a href = http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-2.html#ss2.1 rel = nofollow> http://tldp.org/HOWTO/Bash-Prog- Intro-HOWTO-2.html#ss2.1
这篇关于在Linux系统上部署Java项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!