If you are using the Java+PHP Image, you can deploy java application directly. Otherwise, you should install Java and Tomcat first. Just one command, you can intall Java and Tomcat on LNMP. 

yum install tomcat-* -y && systemctl enable tomcat && systemctl start tomcat


Using your local Chrome or Firefox to visit java sample applications: http://Internet IP:8080/sample/




To deploy a java application in LNMP+Java, you need to know the following six points:



The details of deploying a website or multiple websites, with or without domain names, are slightly different.


WAR package installation sample 


  1. Download jspMyAdmin war package
  2. Using SFTP to upload your code to the directory: /var/lib/tomcat/webapps
  3. Visit the URL http://Internet IP:8080/jspmyadmin  on your PC,you can access to JspMyAdmin now
  4. If you want to bidding Domain Name, set proxy_pass in the Nginx configuration


Java application responds very slowly?


You may found that the whether a sample or application your installed, the response is very slow. What is the reason? How to solve?


Reason: Java have a class named SecureRandom, This class provides a cryptographically strong random number generator (RNG), it may cause JVM wait for more time but this class is not useful in Linux


Solution: Set recurerandom.source to "file:/dev/./urandom" in the file java.security

path: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64/jre/lib/security/java.security


#1 find this line below
securerandom.source=file:/dev/random

#2 after edited
securerandom.source=file:/dev/./urandom

#3 restart tomcat
systemctl restart tomcat