剛重裝了ubuntu系統,重新設定了jdk1.7環境。在/etc/profile中添加了java環境變數,通過source執行profile指令碼後,使用java和java -version命令可看到jdk的相關資訊。
本以為配置已經成功了,但每次重啟系統之後都會提示沒有安裝jdk這麼奇怪的現象。而且系統還提示:
檢測到系統程式出現問題。
後來重新source了一遍profile檔案,貌似又沒有問題了。但是在eclipse工程中啟動tomcat時,又莫名其妙的崩潰:
org.eclipse.jst.j2ee.internal.deployables.JEEFlattenParticipantProvider## A fatal error has been detected by the Java Runtime Environment:## SIGSEGV (0xb) at pc=0x00007fb5391895a0, pid=3010, tid=140418841745152## JRE version: 7.0_11-b21# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.6-b04 mixed mode linux-amd64 compressed oops)# Problematic frame:# C [libwebkitgtk-1.0.so.0+0x14245a0] void WTF::freeOwnedGPtr<_GdkEvent>(_GdkEvent*)+0x15df0## Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again## An error report file with more information is saved as:# /opt/eclipse/hs_err_pid3010.log## If you would like to submit a bug report, please visit:# http://bugreport.sun.com/bugreport/crash.jsp# The crash happened outside the Java Virtual Machine in native code.# See problematic frame for where to report the bug.#
不得不懷疑jdk的配置出了問題。在終端中,一個個的echo環境變數:
echo $JAVA_HOME
echo $JRE_HOME
echo $CLASSPATH
echo $PATH
echo $TOMCAT_HOME
結果發現jre路徑不正常,JRE_HOME出了問題。很羞愧的改正了過來,但不是很明白,之前為什麼在環境變數還有問題的情況下,還可以查看java資訊。
重啟,並且在eclipse中重新設定了tomcat服務後,運行正常。