Java: Restart Java Process on Debian Server

22,626

Solution 1

Problem solved. I've verified that the java process is the execution of a jar, so just killing and re-launch it.

The clue has been that in my local pc the jre don't have a daemon-like process.

Solution 2

apt-get install oracle-java8-jdk/jre would not create java as a service. It would install the JDK/JRE so that you can run jar files as such:

# java -jar myjarfile.jar

The java process on your server might have been started this way in a console or tty.

If you want to run this jar as a service, you need to create a wrapper script that supports start, stop, restart etc. (like explained here) Without a wrapper script, a java .jar program cannot be managed as a service on Linux.

If your java process was a tomcat server, as read in the comment, you could start it by manually by running

# catalina.sh start

Tomcat comes with wrapper scripts to run it as a service. If it was installed this way on your server, you could try to start it using

# sudo service tomcat8 start

See tomcat running documentation for more info

Share:
22,626
newUser.java
Author by

newUser.java

Updated on July 18, 2022

Comments

  • newUser.java
    newUser.java almost 2 years

    I'm using a remote server and to clean up some amount of RAM I've restarted some (not system) services in use but I can't restart the java process because the 'service' command can't find it (isn't a service? it's an oracle-java8 installation through the official apt-get installer).

    enter image description here

    Any suggestion?

    [I've readed the other questions but there is not a proper solution for my case, I don't want to execute strange scrips. sorry]