Tomcat procrun installer does not work with spaces in path for catalina_home

450 Views Asked by At

I'm installing tomcat from the .zip and using the service.bat file. I noticed that it does not set things right if the catalina_base or catalina_home paths have spaces in them.

I call service.bat with the following:

set CATALINA_HOME=C:\Program Files\Apache Software Foundation\Tomcat 10.0
set CATALINA_BASE=C:\Program Files\Apache Software Foundation\Tomcat 10.0
set JRE_HOME=C:\Program Files (x86)\Java\jre1.8.0_151
set SERVICE_STARTUP_MODE=auto

call "%CATALINA_HOME%\bin\service.bat" install

Here is the command that is output from service.bat:

 "C:\Program Files\Apache Software Foundation\Tomcat 10.0\bin\Tomcat10.exe" //IS//Tomcat10     
    --Description "Apache Tomcat 10.0.5 Server - https://tomcat.apache.org/"     
    --DisplayName "Apache Tomcat 10.0 Tomcat10"     
    --Install "C:\Program Files\Apache Software Foundation\Tomcat 10.0\bin\Tomcat10.exe"     
    --LogPath "C:\Program Files\Apache Software Foundation\Tomcat 10.0\logs"     
    --StdOutput auto     
    --StdError auto     
    --Classpath "C:\Program Files\Apache Software Foundation\Tomcat 10.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 10.0\bin\tomcat-juli.jar"     
    --Jvm "C:\Program Files (x86)\Java\jre1.8.0_151\bin\client\jvm.dll"     
    --StartMode jvm     
    --StopMode jvm     
    --StartPath "C:\Program Files\Apache Software Foundation\Tomcat 10.0"     
    --StopPath "C:\Program Files\Apache Software Foundation\Tomcat 10.0"     
    --StartClass org.apache.catalina.startup.Bootstrap     
    --StopClass org.apache.catalina.startup.Bootstrap     
    --StartParams start     
    --StopParams stop     
    --JvmOptions "-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 10.0;-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 10.0;-Dignore.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 10.0\endorsed;-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 10.0\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 10.0\conf\logging.properties;"     
     --JvmOptions9 "--add-opens=java.base/java.lang=ALL-UNNAMED#--add-opens=java.base/java.io=ALL-UNNAMED#--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED"     
    --Startup "auto"     
    --JvmMs "128"     
    --JvmMx "256" 

This causes many issues because the jvm options don't go in right because there is no proper quotes to handle the spaces in the paths. How can I handle this?

FYI This causes the config elements of Tomcat to not be able to locate ${catalina.home} for logging and pathing.

0

There are 0 best solutions below