Using java_ Opts env variable running Java is invalid

In the shell script, I set up Java_ Opts environment variable (to enable remote debugging and increase memory), and then 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 there seems to be no Java_ Opts env variable, because I can't connect to remote debugging, I see no change in JVM memory

What could be the problem?

PS: I can't use Java - jar analyze These settings are used in the jar $* command because I process command - line parameters in my application

Solution

I don't know any actual check Java_ JVM for opts environment variable Usually this is the script used to start the JVM, and they usually just add it to the Java command line

The key to understand here is in - jar analyze The Java parameters before the jar bit will only affect the JVM and will not be passed to your program Therefore, modify the Java line in the script to:

java $JAVA_OPTS -jar analyse.jar $*

It should be "just work"

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>