1. What is jps
Jps (Java Virtual Machine Process Status Tool) is a command provided by JDK 1.5 to display the pid of all current java processes . It is simple and practical, and is very suitable for simply viewing some simple situations of the current javaJVM process on the linux/unix platform .
2.jps common commands
2.1jps command
[root@localhost ~]# jps 2966 Jps
2.2 Only pid is displayed, class name, jar file name and parameters passed to the main method are not displayed
[root@localhost bin]# jps -q 3089 3076
2.3 Output the parameters passed to the main method, which may be null on embedded jvm
[root@localhost bin]# jps -m 3076 Bootstrap start 3140 Jps -m
2.4 Output the full package name of the main class of the application or the full path name of the jar file of the application
[root@localhost bin]# jps -l 3076 org.apache.catalina.startup.Bootstrap 3158 sun.tools.jps.Jps
2.5 To output the parameters passed to the JVM, you can add parameters to tomcat to pass to the JVM, which will be explained in detail below.
[root@localhost bin]# jps -v 3076 Bootstrap -Djava.util.logging.config.file=/root/myInstall/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Dignore.endorsed.dirs= -Dcatalina.base=/root/myInstall/tomcat7 -Dcatalina.home=/root/myInstall/tomcat7 -Djava.io.tmpdir=/root/myInstall/tomcat7/temp 3176 Jps -Denv.class.path=.:/jre/lib/rt.jar:/lib/dt.jar:/lib/tools.jar -Dapplication.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64 -Xms8m
3. Add startup parameters to tomcat and pass them to jvm
3.1 View the default added to the JVM startup parameters
[root@localhost bin]# jps -v 3616 Jps -Denv.class.path=.:/jre/lib/rt.jar:/lib/dt.jar:/lib/tools.jar -Dapplication.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64 -Xms8m
3.2 Start tomcat and view the parameters on the tomcat startup belt
[root@localhost bin]# jps -v 4582 Bootstrap -Djava.util.logging.config.file=/root/myInstall/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Dignore.endorsed.dirs= -Dcatalina.base=/root/myInstall/tomcat7 -Dcatalina.home=/root/myInstall/tomcat7 -Djava.io.tmpdir=/root/myInstall/tomcat7/temp 4620 Jps -Denv.class.path=.:/jre/lib/rt.jar:/lib/dt.jar:/lib/tools.jar -Dapplication.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64 -Xms8m
3.3 Find the /bin/catalina.sh file in the tomcat directory, add it in the first line, jvm startup parameters
export JAVA_OPTS="-Xms1024m -Xmx1024m -Xss512K -XX:PermSize=256m -XX:MaxPermSize=256m"
3.4 Start tomcat and check that the above parameters have been added.
4467 Jps -Denv.class.path=.:/jre/lib/rt.jar:/lib/dt.jar:/lib/tools.jar -Dapplication.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64 -Xms8m 4427 Bootstrap -Djava.util.logging.config.file=/root/myInstall/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms1024m -Xmx1024m -Xss512K -XX:PermSize=256m -XX:MaxPermSize=256m -Djdk.tls.ephemeralDHKeySize=2048 -Dignore.endorsed.dirs= -Dcatalina.base=/root/myInstall/tomcat7 -Dcatalina.home=/root/myInstall/tomcat7 -Djava.io.tmpdir=/root/myInstall/tomcat7/temp
3.5 Check whether tomcat is started successfully
If the following conditions occur, the startup is successful:
[root@localhost bin]# ps -ef|grep java root 4582 1 0 16:27 pts/0 00:00:02 /usr/bin/java -Djava.util.logging.config.file=/root/myInstall/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Dignore.endorsed.dirs= -classpath /root/myInstall/tomcat7/bin/bootstrap.jar:/root/myInstall/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/root/myInstall/tomcat7 -Dcatalina.home=/root/myInstall/tomcat7 -Djava.io.tmpdir=/root/myInstall/tomcat7/temp org.apache.catalina.startup.Bootstrap start root 4674 3814 0 16:31 pts/0 00:00:00 grep --color=auto java
Kill the tomat process with a pid of 4582, and the result is as follows:
[root@localhost bin]# kill 4582 [root@localhost bin]# ps -ef|grep java root 4690 3814 0 16:32 pts/0 00:00:00 grep --color=auto java
、