Mono Jamoon
Mono Jamoon

Reputation: 4607

How to set multiple JAVA_OPTS options in startup.bat

I am trying to pass multiple parameters when I start tomcat through startup.bat. I tried adding these lines at the top of startup.bat file, however they do not work.

set JAVA_OPTS="-Dapplication.home=E:\\webapp -Dfilepath=D:\\newFolder\\conf\\con.properties"

Initially I was running the application with just one parameter -Dapplication.home=E:\\webapp which worked fine. Now I need to pass another parameter and this method fails. Please advice.


On running, I get this exception a FileNotFoundException:

java.io.FileNotFoundException: E:\webapp -Dfilepath=D:\newFolder\conf\con.properties (The filename, directory name, or volume label syntax is incorrect)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at java.io.FileInputStream.<init>(FileInputStream.java:79)

The code is reading the entire segment as a single argument.

Upvotes: 13

Views: 38571

Answers (2)

Evgeniy Dorofeev
Evgeniy Dorofeev

Reputation: 136132

try without quotes

set JAVA_OPTS=-Dapplication.home=E:\\webapp -Dfilepath=D:\\newFolder\\conf\\con.properties

should work

Upvotes: 31

jay
jay

Reputation: 811

set JAVA_OPTS=%JAVA_OPTS% -Dapplication.home="E:\\webapp"

set JAVA_OPTS=%JAVA_OPTS% -Dfilepath="D:\\newFolder\\conf\\con.properties"

Upvotes: 12

Related Questions