Apparently the correct form is without the ""
As in
set JAVA_OPTS=-Xms512M -Xmx1024M
Answer from wannabeartist on Stack OverflowHi
Im creating a Gatling performance testing suit and need to start the test execution with a PS1 file.
What need to happen is that I need to set JAVA_OPTS variable so that the Gatling tests can use them.
To set the JAVA_OPTS in a BAT file i type
set JAVA_OPTS="-Dfoo=bar"
this creates a variable called "foo" with a value "bar"
How do I set the JAVA_OPTS in a PS1 file?
java - How do I use the JAVA_OPTS environment variable? - Stack Overflow
java - Setting JAVA_OPTS in windows using command prompt - Stack Overflow
java - How to set JAVA_OPTS in Intellij for a Spring Boot project? - Stack Overflow
where to set the JAVA_OPTS for Max memory alloc...| JBoss.org Content Archive (Read Only)
Videos
JAVA_OPTS is the standard environment variable that some servers and other java apps append to the call that executes the java command.
For example in tomcat if you define JAVA_OPTS='-Xmx1024m', the startup script will execute java org.apache.tomcat.Servert -Xmx1024m
If you are running in Linux/OSX, you can set the JAVA_OPTS, right before you call the startup script by doing
JAVA_OPTS='-Djava.awt.headless=true'
This will only last as long as the console is open. To make it more permanent you can add it to your ~/.profile or ~/.bashrc file.
Just figured it out in Oracle Java the environmental variable is called: JAVA_TOOL_OPTIONS
rather than JAVA_OPTS
on windows you have to set the variable like:
set JAVA_OPTS = “-Xdebug , server=y”
and use it this way
java %JAVA_OPTS% –cp .Server
Windows uses "%JAVA_OPTS% rather than "$JAVA_OPTS" which is UNIX/LINUX. You can check if the environment is updated with JAVA_OPTS by echoing that: echo %JAVA_OPTS%.
