tomcat的jsvc
来源:百度知道 编辑:UC知道 时间:2024/09/28 07:46:52
用来启动tomcat,在linux下面使用
在linux上以服务的方式启动java程序
1.安装jsvc
在tomcat的bin目录下有一个jsvc.tar.gz的文件,进入tomcat的bin目录下
#tar xvfz jsvc.tar.gz
#cd jsvc-src
#sh support/buildconf.sh
#chmod 755 configure
#./configure --with-java=/usr/local/java (改成你的JDK的位置)
#make
2.编写服务启动类
package com.sohu.jsvc.test;
public class TestJsvc {
public static void main(String args[]) {
System.out.println("execute main method!");
}
public void init() throws Exception {
System.out.println("execute init method!");
}
public void init(String[] args) throws Exception{
System.out.println("execute init(args) method");
}
public void start() throws Exception {
System.out.println("execute start method!");
}
public void stop() throws Exception {
System.out.println("execute stop method!");
}
public void destroy() throws Exception{