Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 860
Mono Jamoon Avatar asked Sep 24 '13 12:09

Mono Jamoon


People also ask

How to set JAVA_OPTS environment variable in Linux?

Set JAVA_OPTS Environment Variable We can set the heap size with JAVA_OPTS using the Set command. Run the following command to set the heap size with JAVA_OPTS . Where -Xms is the minimum heap size and -Xmx is the maximum heap size. Run the command prompt as administrator and run the command above.

What is Java_options?

JAVA_OPTS is an environment variable that you can set to pass custom settings to the Java Virtual Machine (JVM) that runs Liquibase.

Where is JAVA_OPTS defined?

JAVA_OPTS is the standard environment variable that some servers and other java apps append to the call that executes the java command. This will only last as long as the console is open. To make it more permanent you can add it to your ~/. profile or ~/.


Video Answer


2 Answers

try without quotes

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

should work

like image 189
Evgeniy Dorofeev Avatar answered Oct 08 '22 19:10

Evgeniy Dorofeev


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

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

like image 9
jay Avatar answered Oct 08 '22 19:10

jay