JSVC re-exec requires execution with an absolute or relative path

716 views Asked by At

My Class:

import org.apache.commons.daemon.Daemon;
import org.apache.commons.daemon.DaemonContext;
import org.apache.commons.daemon.DaemonInitException;

public class Main implements Daemon {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }

    @Override
    public void init(DaemonContext daemonContext) throws DaemonInitException, Exception {
        System.out.println("init!");
    }

    @Override
    public void start() throws Exception {
        System.out.println("start!");
    }

    @Override
    public void stop() throws Exception {
        System.out.println("stop!");
    }

    @Override
    public void destroy() {

    }
}

I run jsvc follow document like this:

jsvc -cp Daemon.jar Main
or
jsvc -cp Daemon.jar MainClass
or
jsvc -cp ./commons-daemon-1.1.0.jar:./Daemon.jar MainClass

It's also return:

JSVC re-exec requires execution with an absolute or relative path

Who can explain this? Help me please!!!.

1

There are 1 answers

0
Dude On

Try specifying the full path to the jsvc executable.