How to set multiple JAVA_OPTS options in startup.bat

隐身守侯 提交于 2020-08-24 07:27:48

问题


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.


回答1:


try without quotes

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

should work




回答2:


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

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



来源:https://stackoverflow.com/questions/18982083/how-to-set-multiple-java-opts-options-in-startup-bat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!