問題現象:
eclipse按裝maven插件之後,每次啟動eclipse都會彈出:
eclipse is running in a jre, but a jdk is required
some maven plugins may not work when importing projects or updating source folders.
問題原因:
從提示資訊上看,就是說eclipse是運作在jre環境中,但maven插件需要jdk環境。
根本原因是eclipse沒有使用java_home,而是使用的c:\windows\system32(64位系統是syswow64目錄)中的javaw.exe啟動的,而maven在進行編譯運作時可能會使用到jdk相關的工具(例如:com.sun.tools.jar)。
解決方法:
1>先在eclipse的installed jres修改為jdk;
2>再将eclipse安裝目錄下的eclipse.ini,在eclipse.ini配置檔案頭部添加如下兩行:
-vm
c:\progra~2\java\jdk1.6\jre\bin\javaw // jdk的安裝目錄,注意路徑中不要有空格。