Catalina.bat permits me to set the environment variable _RUNJAVA before calling «catalina.bat start». If the variable value contains space, e.g. is from WSL export _RUNJAVA=\"C:\\Program\ Files\ \(x86\)\\Java\\jdk1.8.0_361\\bin\\java.exe\"; export WSL=_RUNJAVA ; cmd.exe /c 'catalina.bat start' then the output it Files was unexpected at this time. “Files“ is from “Program Files”. In I replace in setclasspath.bat > if not "%_RUNJAVA%" == "" goto gotRunJava with > if not defined %_RUNJAVA% goto gotRunJava then the problem disappears. Yes, Java 8 does not run with Tomcat 11. But this problem actually appears with Tomcat 9 and setclasspath.bat has not changed between Tomcat 9 and Tomcat 10.1. • In bin/setclasspath.bat replace «if not "%_RUNJAVA%" == "" goto gotRunJava» with «if not defined %_RUNJAVA% goto gotRunJava».
For those trying to recreate this, WSL appears to be a red herring. Simply creating a _RUNJAVA variable containing a space is sufficient to break things.
The same problem is described at https://bz.apache.org/bugzilla/show_bug.cgi?id=66056 In the bug report I wrote as substutution > if not defined %_RUNJAVA% goto gotRunJava but it should be > if defined _RUNJAVA goto gotRunJava
I think there may be some issues with spaces in the path to Java but the example in the original report is wrong. It uses set VAR="value with spaces" it should be set "VAR=value with spaces" I'm continuing to investigate spaces in JAVA_HOME and _RUNJAVA
The issue was just with _RUNJAVA and _RUNJDB Fixed in: - 11.0.x for 11.0.0-10 onwards - 10.1.x for 10.1.12 onwards - 9.0.x for 9.0.79 onwards - 8.5.x for 8.5.92 onwards