~ Essays B025 ~ Linux sh script to perform regular tasks, change jdk

Intro: linux package into the jar, the use of regular monitoring items and start crontab (crontab -e)

(Test: executed once every three minutes)

 

 

Qustion1.Exception in thread "main" java.lang.UnsupportedClassVersionError

 

 Answer1. Compile in eclipse using java version "1.8.0_111", while the server version java version "1.8.0_066", incompatible cause problems. (I will be here in linux jdk replace 1.8.0_111)

step1: View linux version of Java java -version

step2: Uninstall

  rm -rf JDK address (uninstall JDK) rm -rf /usr/java/jdk/jdk1.8.0_066/

step3: Download

  wget http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz

step4: unzip

  Execute: tar -zxvf jdk-8u171-linux-x64.tar.gz 

  Error: The following diagram

  

 

. Qustion2 use wget command to directly download the JDK, resulting in tar package can not command to extract
Answer2: to Oracle's official website downloaded jdk children's shoes should know, need to agree to the installation of Oracle agreement before downloading, otherwise it can not be downloaded, but with wget way, default do not agree, although able to download, but downloaded file there will be problems, so unzip on Linux has failed. (Article results from students https://www.cnblogs.com/shamo89/p/9265220.html )

step5: retest java -version

  After connecting to the server again closed Xshell, the test is successful.

step6: Linux timed task starts jar

  Qustion3:      

  

   Answer3: linux can not find the Java command, the more absolute path here

  

 

   Qustion4:  /var/spool/mail/root

  

 

   View this message found as follows:

  

  Answer4: linux lsof command can not be found, the more absolute path here (with the Java command)

  

 

Guess you like

Origin www.cnblogs.com/gaojl/p/11585230.html