在我们用IDEA运行程序时:出现这样错误
The JRE_HOME environment variable is not defined correctly
This environment variable is needed to run this program
Disconnected from server
Application Server was not connected before run configuration stop, reason: Unable to ping server at localhost:1099
可以找到tomcat安装目录下的setclasspath.bat文件,像我就是在E盘
E:\JAVA\apache-tomcat-9.0.10-windows-x64\apache-tomcat-9.0.10\bin\setclasspath.bat
然后用个文本编辑器打开
添加如图所示两行(黄线的部分),其实就是你的jdk和jre的安装路径,之后退出保存。再运行就可以成功了