1. Install JDK Check the computer's operating digits: uname -ar
Download address of jdk, it is recommended to download the tar.gz package Now start the official installation of JDK 1. Upload the jdk installation package to /root jdk-8u131-linux-x64.tar.gz 2. Confirm whether the system has already installed JDK rpm -qa|grep jdk rpm -e --nodeps software name //If it is checked that it is installed, execute the uninstall command 3. Unzip the jdk installation package to the specified directory tar -xvf jdk-8u131-linux-x64.tar.gz -C /usr/local/ 4. Enter the decompression directory cd /usr/local 5. Modify the jdk folder name mv jdk1.8.0_131 jdk 6. Configure environment variables Modify the environment variable configuration file: vi /etc/profile Press i to enter edit mode Jump to the last line and add the following content. Please note that the JDK here should be consistent with the path where you installed JDK. #java runtime setting export JAVA_HOME=/usr/local/jdk export CLASSPATH=$JAVA_HOME/lib:. export PATH=$JAVA_HOME/bin:$PATH Press ESC and enter :wq to save and exit 7. Reload environment configuration source /etc/profile 8. Test whether JDK installation is ok java -version 9. Write hello.java vi Hello.java class Hello{ public static void main(String[] args){ System.out.println("hello,java"); } } Then press ESC :wq to exit vi /etc/profile i write javac Hello.java 2. Deploy jar package 1. Create data, then create a test directory, and create related folders and files according to the following structure The directory structure is: Place the main jar package under app, such as myjar, and the following is the content of the related restart.sh: #!/bin/bash base_home='/data/test' app_name='myjar' pid=`ps -ef|grep ${app_name}|grep -v grep|grep -v restart|awk '{print$2}'` if [ -n "${pid}" ] ;then kill -9 ${pid} sleep 10 fi gclog_file=$base_home/log/gc.log dump_dir=$base_home/heapdump errorlogs_dir=$base_home/log java -Xmx1g -Xms1g -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:GCLogFileSize=128M -XX:NumberOfGCLogFiles=1 -Xloggc:${gclog_file} -XX:HeapDumpPath=${dump_dir} -jar $base_home/app/${app_name}.jar --spring.config.location=$base_home/config/application.yml >> $base_home/log/${app_name}_$(date +'%Y%m%d').log & It should be noted here that Error: Unable to access jarfile /app/myjar.jar Here you may need to change to an absolute path, as follows: /datat/test/app/${app_name}.jar Access the relevant path: (modify here according to the relevant port of your jar http://ip:8080/ View the log path:
Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: A practical record of restoring a MySQL Slave library
>>: Vue two same-level components to achieve value transfer
This article introduces in detail some of the tech...
Preface: rm under Linux system is irreversible. T...
Statement 1: <link rel="shortcut icon"...
1. Introduction to Distributed Storage System Wit...
1. Introduction Some time ago, there were a serie...
Table of contents Build Vuex environment Summariz...
The first tutorial for installing MySQL-5.7.19 ve...
Some usage of float Left suspension: float:left; ...
Table of contents 1. What is a design pattern? 2....
After solving the form auto-fill problem discussed...
What is a directive? Both Angular and Vue have th...
step Place the prepared static resource files in ...
This article records the specific steps for downl...
This article originated from my complaints about ...
1. Background 1.1 Problems A recent product testi...