Running java with JAVA_OPTS env variable has no effect

前端 未结 2 1706
野性不改
野性不改 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:20

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

    0 讨论(0)
  • 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".

    0 讨论(0)
提交回复
热议问题