Skip to main content

How to install JSVC on Linux WidenHome Log | WidenHome Log

How to install JSVC on Linux WidenHome Log | WidenHome Log

In our team, we have a lot of Java standalone applications which should be run as daemon on Unix/Linux system, and we found JSVC is the best choice for us to wrap Java programs to daemons. This article records the steps on how to install JSVC executable on Linux, which is our stage/prod environment.

Download JSVC source package

First of all, we need to download JSVC source package from this URL:http://commons.apache.org/daemon/download_daemon.cgi, for example, I downloaded commons-daemon-1.0.5-src.tar.gz file. Or, download it via wget:

wget -c http://apache.etoak.com/commons/daemon/source/commons-daemon-1.0.5-src.tar.gz 

Build JSVC executable
Unzip the source package and build JSVC executable.

chmod 755 commons-daemon-1.0.5-src.tar.gz tar zxvf commons-daemon-1.0.5-src.tar.gz cd commons-daemon-1.0.5-src/src/native/unix 

Before building the JSVC executable, please make sure you have set JAVA_HOME variable correctly. And make sure you have “autoconf” and “make” installed, otherwise, install it by:

yum install autoconf yum install make 

After that, we can configure and make the JSVC executable now.

sh support/buildconf.sh ./configure --with-java=/opt/apps/jdk make clean make 

Eventually, move the “jsvc” to another folder and add that folder on PATH environment variable.

mv jsvc /opt/apps/commons-daemon vi ~/.bashrc 

Add two lines in .bashrc:

PATH=/opt/apps/commons-daemon:$PATH export PATH 

And then load the latest setting:

source ~/.bashrc

Now, we can use this command in script which will launch Java application as daemon.

Please make sure to add commons-daemon-x.jar into classpath, otherwise, we would see this error:

Cannot find daemon loader org/apache/commons/daemon/support/DaemonLoader Service exit with a return value of 1 

For more information on how to use jsvc command, please refer tohttp://commons.apache.org/daemon/jsvc.html

Comments

  1. thanks, this was very usefull!

    ReplyDelete
  2. thanks, helps alot

    ReplyDelete
  3. 404, Thanks, asshole

    ReplyDelete
  4. Respect and that i have a dandy present: How Much Is A Complete House Renovation whole home remodel cost

    ReplyDelete

Post a Comment

Popular posts from this blog

Regression Testing

From  http://www.softwaretestinghelp.com/regression-testing-tools-and-methods/ The selective retesting of a  software  system that has been modified to ensure that any  bugs  have been fixed and that no other previously working functions have failed as a result of the reparations and that newly added features have not created problems with previous versions of the  software . Also referred to as  verification testing , regression testing is initiated after a  programmer  has attempted to fix a recognized problem or has added  source code  to a program that may have inadvertently introduced errors. It is a  quality  control measure to ensure that the newly modified code still complies with its specified requirements and that unmodified code has not been affected by the maintenance activity. What is Regression Software Testing? Regression means retesting the unchanged parts of the application. Test cases are re-execu...

Spring MVC 3.2 Preview: Introducing Servlet 3, Async Support

Continuing the Spring 3.0 "simplification series" started by Keith and Chris , I would like to provide a quick overview of simplifications in scheduling and task execution enabled by Spring 3.0. I will be walking through a basic sample application that you can checkout from the spring-samples Subversion repository. It has been designed to be as simple as possible while showcasing both annotation-driven and XML-based approaches to scheduling tasks in Spring 3.0. Let's begin with the annotation-driven approach. You can run it directly via the main() method in AnnotationDemo. If you take a look, you'll see that it's nothing more than a bootstrap for a Spring ApplicationContext: public static void main(String[] args) {      new ClassPathXmlApplicationContext( "config.xml" , AnnotationDemo. class ); } The reason nothing else is necessary is that the ApplicationContext contains an "active" component, which we will...