YAJSW Java 初学者示例
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15112048/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
YAJSW Java beginner examples
提问by Wearybands
Can anyone help me in either providing me some right direction towards using yajsw using java language to use java application as service or just provide me some basic code of hello world application which i can run as service. I googled it but could not find any thing useful.
任何人都可以帮助我为我提供一些正确的方向,以使用 java 语言使用 yajsw 来使用 java 应用程序作为服务,或者只是为我提供一些我可以作为服务运行的 hello world 应用程序的基本代码。我用谷歌搜索但找不到任何有用的东西。
Thanks in advance
提前致谢
回答by Nick
YAJSW's documentation provides everything you need here. http://yajsw.sourceforge.net/
YAJSW 的文档在这里提供了您需要的一切。http://yajsw.sourceforge.net/
The easiest way to get running is to execute your jar with your own start script. Then you need to figure out what PID that java process is running as. Once you have the pid all you need to do is run either ./yajsw/yajsw##someversion##/bat/genConfig.bat or if your in linux run the ./yajsw/yajsw##someversion##/bin/genConfig.sh .
运行的最简单方法是使用您自己的启动脚本执行您的 jar。然后你需要弄清楚java进程正在运行的PID。一旦你有了 pid,你需要做的就是运行 ./yajsw/yajsw##someversion##/bat/genConfig.bat 或者如果你在 linux 中运行 ./yajsw/yajsw##someversion##/bin/genConfig .sh 。
If successful this will create a wrapper.conf that is targeted towards your executable jar. This is plenty to get you going and off the ground. After that you can tweak the heck out of it for your own customizations.
如果成功,这将创建一个针对您的可执行 jar 的 wrapper.conf。这足以让您开始工作。之后,您可以根据自己的自定义调整它。
The (genConfig.bat or genConfig.sh)'s argument is the PID. So run genConfig.bat #PID# !
(genConfig.bat 或 genConfig.sh) 的参数是 PID。所以运行 genConfig.bat #PID# !
PS: The config generator will add the classpath of each jar .. when it is easier just to add one classpath as wrapper.java.classpath.1 = .\lib\* instead.
PS:配置生成器将添加每个 jar 的类路径 .. 当更容易添加一个类路径作为 wrapper.java.classpath.1 = .\lib\* 代替。
回答by djangofan
Ok, you can start by downloading JBoss 5.x and using this wrapper script I wroteto get it running. This serves just as an example for you. You would have to edit it to run whatever your application happens to be.
好的,您可以先下载 JBoss 5.x 并使用我编写的这个包装器脚本来运行它。这仅作为您的示例。您必须编辑它才能运行您的应用程序。
I also wrote a script for JBoss 7 servers.
我还为 JBoss 7 服务器编写了一个脚本。