'tools.jar' is not in IDEA classpath. Please ensure JAVA_HOME points to JDK rather than JRE.

‘tools.jar’ is not in IDEA classpath.
Please ensure JAVA_HOME points to JDK rather than JRE.

前几天idea用着还好好的,今天打开的时候报了个错误
首先确定自己有装jdk

java -version
'tools.jar' is not in IDEA classpath. Please ensure JAVA_HOME points to JDK rather than JRE.

如果没有安装请自行安装,如果如上图所示已经有jdk了,输入以下命令

sudo update-alternatives –config java

根据提示选择jdk而非jre

'tools.jar' is not in IDEA classpath. Please ensure JAVA_HOME points to JDK rather than JRE.

重新打开idea成功