The JRE you are running Eclipse with appears to not be a JDK .Spring Boot Live hovers will not work with a plain JREjavascript
** 由於以前安裝java時,先裝了 java 11,後來裝了Java8 ** Eclipse運行是須要一個JRE(後來才知道有一個ini 配置文件) ** 這個JRE並非系統環境變量中的javac目錄下的JRE ** 而是JDK安裝時候自帶的JRE目錄,此目錄下並沒有javachtml
Window > Preferences > Java > Installed JREs > Execution Environments ** 確認已經設置爲 java 8 了!並非 java 11! ** 單獨對項目 property ,也都是 java 8 !java
sudo update-alternatives --config java 再次選擇一下 java 版本 而後 open 剛纔 close 的 project。再次 restart eclipse,好像就不出錯了! 可是,退出去再來!仍是那個錯誤!ubuntu
1. 查看全部 jdk 安裝版本 sudo update-java-alternatives -l 返回結果以下: java-1.11.0-openjdk-amd64 1101 /usr/lib/jvm/java-1.11.0-openjdk-amd64 java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64 2. 刪除 jdk 1.11。0 sudo apt-get remove java-1.11.0-openjdk-amd64sudo apt-get remove java-1.11.0-openjdk-amd64 [sudo] password for dhbm: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package java-1.11.0-openjdk-amd64 E: Couldn't find any package by glob 'java-1.11.0-openjdk-amd64' E: Couldn't find any package by regex 'java-1.11.0-openjdk-amd64' ** 包名不叫這個啊! 3.參考 ubuntu 命令行卸載並清理軟件
https://blog.csdn.net/hanshileiai/article/details/46972869 ubuntu如何徹底卸載Java https://blog.csdn.net/w2222288/article/details/53887071app
4. 查找 java ,裏面沒有 jdk 1.11 dpkg --get-selections | grep java ca-certificates-java install gir1.2-javascriptcoregtk-4.0:amd64 install java-common install libatk-wrapper-java install libatk-wrapper-java-jni:amd64 install libjavascriptcoregtk-4.0-18:amd64 install 5. 查找 jdk dpkg --get-selections | grep jdk openjdk-11-jre:amd64 install openjdk-11-jre-headless:amd64 install openjdk-8-jdk:amd64 install openjdk-8-jdk-headless:amd64 install openjdk-8-jre:amd64 install openjdk-8-jre-headless:amd64 install 找到了! 6. 移除 jdk 11 sudo apt-get remove openjdk-11-jre:amd64 sudo apt-get remove openjdk-11-jre-headless:amd64 7. 清理殘留數據 dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P (Reading database ... 168839 files and directories currently installed.) Purging configuration files for openjdk-11-jre-headless:amd64 (10.0.2+13-1ubuntu0.18.04.4) ... 而後,sudo reboot!
** 完蛋了!仍是指向了 java 11 !怎麼辦? ** 重裝 Eclipse,再啓動,仍是以上錯誤啊! ** 由於我並無卸載 Eclipse,直接覆蓋安裝的!因此纔想到,Eclipse 本身應該有配置文件!(刪除 java 11 以前想到就行了!)less
cd /home/dhbm/Desktop/eclipse2019 ls configuration eclipse eclipse.ini.bak icon.xpm META-INF plugins dropins eclipse.ini epl-v10.html license.txt notice.html readme
真的是有 configuration,還有eclipse.ini,打開eclipse.ini,原來問題在這裏啊! eclipse
把這裏改爲 java 8 ,OK! -vm /usr/lib/jvm/java-8-openjdk-amd64/bin ** 再次抄錄一下以前的學習記錄,由於過程當中可能刪除了桌面快捷! 建立 Eclipse 桌面快捷 先去圖形界面下找到 eclipse ,複製路徑 /home/dhbm/eclipse/java-2018-12/eclipse ** Ubuntu 中文版 ln -s ~/eclipse/jee-2018-12/eclipse ~/桌面/eclipse2019 ln -s ~/eclipse/jee-2018-12/eclipse/eclipse ~/桌面/eclipse201901 ** Ubuntu 英文版 ln -s /home/dhbm/eclipse/java-2018-12/eclipse /home/dhbm/Desktop/eclipse2019 ln -s /home/dhbm/eclipse/java-2018-12/eclipse/eclipse ~/Desktop/ecli