Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 完美解决(tomcat error)
生活随笔
收集整理的這篇文章主要介紹了
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 完美解决(tomcat error)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
error:
Linux下啟動和關(guān)閉tomcat報錯,如下圖所示:
原因:
因為啟動tomcat會調(diào)用tomcat安裝文件中的startup.bat,而它調(diào)用了catalina.bat則調(diào)用了setclasspath.bat。因此需要在setclasspath.bat的開頭手動聲明環(huán)境變量。
解決方案:
用vim打開tomcat的bin目錄下的setclasspath.sh,添加JAVA_HOME和JRE_HOME兩個環(huán)境變量(下圖紅色方框內(nèi)),兩個環(huán)境變量路徑為您安裝的java JDK的路徑。
windows下將export改為set即可。
保存并且退出即可。
再次使用service tomcat start沒報錯,如下圖所示
成功用service tomcat start開啟tomcat服務(wù)。
總結(jié)
以上是生活随笔為你收集整理的Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 完美解决(tomcat error)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 工具类集合
- 下一篇: Errors while executi