Escape characters in VM Option
Answered
Hello,
I have a Java app to run in a Tomcat server. I have to pass some arguments to the VM of Tomcat. One of them is:
-Dhttp.nonProxyHosts=127.0.0.1|localhost|*.my.fqdn.com
(Notice the "|" characters").

Sadly this parameter prevent the Tomcat startup and I got an error saying "localhost is not recognized as a command (...)"
I've tried multiple versions of this line but none of them are working. Eg:
"-Dhttp.nonProxyHosts=127.0.0.1|localhost|*.my.fqdn.com"
-Dhttp.nonProxyHosts="127.0.0.1|localhost|*.my.fqdn.com"
-Dhttp.nonProxyHosts=127.0.0.1\|localhost\|*.my.fqdn.com
-Dhttp.nonProxyHosts="127.0.0.1\|localhost\|*.my.fqdn.com"
...
Thank you for the help
Please sign in to leave a comment.
Hello,
Try escaping pipes with a cap like this:
See also IDEA-159955.
It's working with the caps, thank you.
@...
In the end, with the line you provided Tomcat is able to start without error but the value of the option (nonProxyHosts) is not used by the VM !
I tested by removing the 127.0.0.1 and localhost values, leaving only the *.my.fqdn.com without caps & pipes and in this case the VM uses the option.
Do you have any idea ?
VM used is:
What if you try the following syntax:
Nope, this one is not working. I'm wondering if on windows the double quotes should also take in the param key but I'm unable to find the right syntax :(
As a workaround, you can try adding the option directly to the <server-home>/conf/catalina.properties file like this:
Or adding the following line to the <server-home>/bin/catalina.bat file:
set "JAVA_OPTS=%JAVA_OPTS% -Dhttp.nonProxyHosts=127.0.0.1^|localhost^|*.my.fqdn.com"Yes it's what I did. I created a setenv.bat in <server-home>/bin/setenv.bat
But I would like to find the right spelling for this option in Intellij.
Thanks for confirming.
I created a new bug report for this on our issue tracker: IDEA-250881, and asked the responsible developer to take a look.
Feel free to subscribe to the ticket for updates. See this article if you are not familiar with YouTrack.