1. 程式人生 > >JDK從1.7.x升到1.8.x後Eclipse Maven打包及Tomcat服務啟動問題處理

JDK從1.7.x升到1.8.x後Eclipse Maven打包及Tomcat服務啟動問題處理

1      Eclipse JDK從1.7.x升級到1.8.xMaven打包問題解決

[INFO] 1 error

[INFO]-------------------------------------------------------------

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO]------------------------------------------------------------------------

[INFO] Total time: 1.552s

[INFO] Finished at: Wed Apr 2610:17:28 CST 2017

[INFO] Final Memory: 10M/112M

[INFO]------------------------------------------------------------------------

[ERROR] Failed to execute goalorg.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)on project fmcgwms: Compilation failure

[ERROR] Unable to locate the JavacCompiler in:

[ERROR] C:\ProgramFiles\Java\jre1.8.0_92\..\lib\tools.jar

[ERROR] Please ensure you are usingJDK 1.4 or above and

[ERROR] not a JRE (thecom.sun.tools.javac.Main class is required).

[ERROR] In most cases you can changethe location of your Java

[ERROR] installation by setting theJAVA_HOME environment variable.

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack traceof the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -Xswitch to enable full debug logging.

[ERROR]

[ERROR] For more information aboutthe errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

1.1  修改Eclipse JRE


1.2  新增JAVA_HOME\lib\tools.jar

選擇1.8版本的JRE:


選中行進行編輯新增:

 

1.3  Eclipse Maven 打包設定

選擇打包專案:

 

設定JRE:

1.4  遷移到生產及測試環境必須重新設定JAVA_HOME

升級部署環境的JDK版本為1.8.x並設定相應的JAVA_HOME等環境變數。

2      Windows JDK升級Tomcat服務問題處理

JDK1.7.x安裝的服務預設使用的是之前的JDK版本,需要解除安裝並重新安裝.

2.1  解除安裝Tomcat服務

cd 進入TOMCAT_HOME\bin目錄輸入:

TOMCAT_HOME\bin\service unstall TOMCAT-SERVER-NAME

2.2  安裝Tomcat服務

cd 進入TOMCAT_HOME\bin目錄輸入:

TOMCAT_HOME\bin\service install TOMCAT-SERVER-NAME

 

由此可見Tomcat服務安裝時是找到了JAVA_HOME環境變數來進行配置的,所以JDK升級後應用程式如果依賴JDK8必須要重新安裝服務。