Running java with JAVA_OPTS env variable has no effect

前端 未结 2 1717
野性不改
野性不改 2020-11-29 01:46

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:



        
2条回答
  •  孤城傲影
    2020-11-29 02:35

    I don't know of any JVM that actually checks the JAVA_OPTS environment variable. Usually this is used in scripts which launch the JVM and they usually just add it to the java command-line.

    The key thing to understand here is that arguments to java that come before the -jar analyse.jar bit will only affect the JVM and won't be passed along to your program. So, modifying the java line in your script to:

    java $JAVA_OPTS -jar analyse.jar $*
    

    Should "just work".

提交回复
热议问题