How to set multiple JAVA_OPTS options in startup.bat

Mono Jamoon picture Mono Jamoon · Sep 24, 2013 · Viewed 26.7k times · Source

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.

Answer

Evgeniy Dorofeev picture Evgeniy Dorofeev · Sep 24, 2013

try without quotes

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

should work