天天看點

ERROR: JAVA_HOME is set to an invalid directory

在調試學習比較火的 熱修複 bug時,生成jar檔案報出的這個問題

ERROR: JAVA_HOME is set to an invalid directory

剛開始的時候各種查找原因,這個問題大概意思就是沒有找到這個

這裡說出我的解決辦法,順便自己做個記錄,就是環境變量設定問題

1、打開環境變量java_home

ERROR: JAVA_HOME is set to an invalid directory

這裡放這個路徑,我之前錯誤路徑就是e:\androidhj\java\jdk1.8.0_201将其修改為圖上路徑

如果沒有建立一個java_home=c:\program files\java\jdk1.8.0_201

2、打開環境變量變量path

ERROR: JAVA_HOME is set to an invalid directory

如果沒有就建立一個

path=c:\program files (x86)\common files\oracle\java\javapath;c:\windows\system32;d:\program files\git\cmd;%systemroot%;%systemroot%\system32\wbem;%java_home%\bin;%java_home%\jre\bin;

查詢結尾是否有這樣一句沒有添加上;%java_home%\bin;%java_home%\jre\bin;

3、最後執行一次

ERROR: JAVA_HOME is set to an invalid directory

通過了

也可在cmd中 java _version進行檢視jdk版本号