Running java with JAVA_OPTS env variable has no effect

Ashika Umanga Umagiliya picture Ashika Umanga Umagiliya · Jan 6, 2010 · Viewed 99.3k times · Source

In a shell script, I have set the JAVA_OPTS environment variable (to enable remote debugging and increase memory), and then I execute the jar file as follows:

export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n -Xms512m -Xmx512m"
java -jar analyse.jar $*

But it seems there is no effect of the JAVA_OPTS env variable as I cannot connect to remote-debugging and I see no change in memory for the JVM.

What could be the problem?

PS: I cannot use those settings in the java -jar analyse.jar $* command because I process command line arguments in the application.

Answer

HEX picture HEX · Jul 23, 2012

You can setup _JAVA_OPTIONS instead of JAVA_OPTS. This should work without $_JAVA_OPTIONS.