Using CentOS under How to configure the Java daemon

Source: Internet
Author: User

in the under Linux, starting the server in the form of a daemon is a very important issue. For example , PHP script can be processed under PHP , and node.JS is available forever processing. What about under the Java? There is a Java wrapper.

1. Download Java wrapper Community version,

http://wrapper.tanukisoftware.com/doc/english/download.jsp

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/82/CC/wKiom1dhEtXxS8YlAADJxgHJwqM395.png "title=" Picture 1.png "alt=" Wkiom1dhetxxs8ylaadjxghjwqm395.png "/>

Download wrapper-linux-x86-64-3.5.29.tar.gz.


2,decompression,tar-xzvf wrapper-linux-x86-64-3.5.29.tar.gz
3. Build java daemon directory,mkdir/usr/local/javaservice
4.copy four folders of Java wrapper to thejavaservice Directory ,

CD wrapper-linux-x86-64-3.5.29,
CP- Rbin/usr/local/javaservice/,
CP- Rconf/usr/local/javaservice/,
CP- Rlogs/usr/local/javaservice/,
CP- Rlib/usr/local/javaservice/
5,cd/usr/local/javaservice,
vi conf/wrapper.conf,

⑴ Locate the wrapper.java.mainclass=and modify it to

Wrapper.java.mainclass=org.tanukisoftware.wrapper.wrappersimpleapp
⑵ Find wrapper.app. Parameter.1, modified to

wrapper.app.parameter.1= the javaclass you really want to run

if ⑴ write the javaclassyou really want to run, you will get an error:

Startup failed:timed out waiting for a signal from the JVM

⑶ Find wrapper. java.classpath.1=, modified to

wrapper.java.classpath.1=. /lib/wrapper.jar

⑷ If you have your own jar Package, you can create a folder,copy all jar packages to this folder, such as /usr/local/javaservice/lib/
Then add the following:

wrapper.java.classpath.2=. /bin/
wrapper.java.classpath.3=/usr/local/javaservice/lib/*.jar

/span>jar

wrapper.java.classpath.3=/usr/local/javaservice/lib/a.jar
< span>
but be careful. jar The back-and-forth dependency order, otherwise it may fail to load after

6 cd bin &NBSP;

⑴ cp Testwrapper yourname, e.g CP Testwrapper myjavaservice

⑵ vi myjavaservice, you can modify :

App_name= "Testwrapper" and app_long_name= "Test Wrapper Sample Application"

⑶ Then add the following line app_long_name :

Basedir=your server path, e.g, basedir=/usr/local/javaservice

⑷ then modify the wrapper_cmd= "./wrapper" and wrapper_conf= ". /conf/wrapper.conf ", instead:

wrapper_cmd= "$basedir/bin/wrapper"

wrapper_conf= "$basedir/conf/wrapper.conf"

7. Create a soft link

sudo ln-s/ usr/local /bin/myjavaservice/etc/init.d/myjavaservice

8. Set boot up

sudo chkconfig –levels 235 myjavaservice on

9. Start:

/etc/init.d/ Myjavaservice start or

Service Myjavaservice Start

Reference:

http://blog.csdn.net/hshxf/article/details/6122213

http://blog.csdn.net/xundh/article/details/50359065

http://bbs.csdn.net/topics/390200181


This article is from the "Programming Art" blog, so be sure to keep this source http://itsart.blog.51cto.com/1005243/1789572

Using CentOS under How to configure the Java daemon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.