Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Restart Java Process on Debian Server

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]

like image 340
newUser.java Avatar asked Oct 30 '22 04:10

newUser.java


1 Answers

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

like image 182
Stijn Haezebrouck Avatar answered Nov 09 '22 12:11

Stijn Haezebrouck