The reason is that later versions of JDK (such as jdk1.6) will not automatically register the environment variables java_home and jre_home after installation. Like my environment in the unit, My users are restricted (poweruser) and it is not convenient to set environment variables, so I found another method.
Let's first look at Tomcat's startup. bat, which calls Catalina. bat, While Catalina. Bat calls setclasspath. bat. You only need to declare the environment variables at the beginning of setclasspath. bat. For example, my environment variables are:
Rem ---------------------------------------------------------------------------
Rem set classpath and Java options
Rem
Rem $ ID: setclasspath. Bat 505241 10: 22: 58z jfclere $
Rem ---------------------------------------------------------------------------
Set java_home = D: \ Java \ jdk1.6.0 _ 11
Set jre_home = D: \ Java \ jre6
Rem make sure prerequisite environment variables are set
If not "% java_home %" = "" Goto gotjdkhome
If not "% jre_home %" = "" Goto gotjrehome
Echo neither the java_home nor the jre_home environment variable is defined
Echo at least on E of these environment variable is needed to run this program
Goto exit
......
In this way, java_home and jre_home are registered every time you run startup. bat. When the console window is closed, the two variables will disappear and will no longer occupy the memory. Run it, and the final prompt is displayed."Information: server startup in XXXXX ms"This is all done.