0

I am trying to run a Java program by using jsvc.

I have installed it by

sudo apt-get install jsvc.

To find out a solution, I tried to read the Apache documentation about it (at https://commons.apache.org/proper/commons-daemon/jsvc.html). But this command:

./jsvc -cp commons-daemon.jar:my.jar MyClass

and this other:

./jsvc -cp my.jar MyClass

did not work (of course, I replace the terms by the name of my class etc.).

It gives me the error:

bash: ./jsvc: no such file or directory of this type

So I use jsvc without "./". And I saw here: How to start tomcat with jsvc? that I should use /usr/bin/jsvc

But an other problem is when I use

/usr/bin/jsvc -cp path/to/my/.jar path/to/my/class 

nothing happens.

I try the link: How to convert a java program to daemon with jsvc?. But there is something I don’t understand: for the "CLASS =", have I to put a .Main file ? And do I have to put the extension name of the file (for the class and the .jar) ?

I decided to put the .java file which contains my main class (once I putted the .jar, then I didn’t). Then I copied the code, and when I write "esac" and pressed the enter key in the Ubuntu console, the console closed up, and then…nothing.

Has someone already encountered this ?

Community
  • 1
  • 1
Chènevis
  • 513
  • 1
  • 9
  • 22

1 Answers1

0

Are you sure your java installation is in /usr/java? Beside this, in the second command there's the directory missing. You should do something like that:

export JAVA_HOME=path/to/java/home
./configure

If you don't know where your java installation is located, try this if you are on a mac/*nix, or this if you have windows.

Community
  • 1
  • 1
Andrea Iacono
  • 772
  • 7
  • 20
  • Yes, I am sure my Java is not in /usr/java, I found links (http://serverfault.com/questions/143786/how-to-determine-java-home-on-debian-ubuntu) to see where is my Java. But it is not the question. – Chènevis Jul 31 '15 at 07:57