英文:
Setting/changing default Java MaxHeapSize or changing default JVM command settings
问题
我正在使用调用jvm的python脚本。不幸的是,该脚本不允许我向jvm命令传递参数,因此我无法通过Xmx
标志来增加最大堆大小。
是否有一种方法可以设置/更改允许的默认MaxHeapSize
或设置/更改任何jvm调用的默认参数?
来自下面回答的JAVA_TOOL_OPTIONS
对我起作用:
# echo $JAVA_TOOL_OPTIONS
-Xmx10g
# java -XX:+PrintFlagsFinal -version | grep MaxHeapSize
Picked up JAVA_TOOL_OPTIONS: -Xmx10g
size_t MaxHeapSize = 10737418240 {product} {command line}
英文:
I'm using a python script that calls the jvm. Unfortunately, the script doesn't allow me to pass arguments to the jvm command, so I can't bump up the max heap size via the Xmx
flags.
Is there a way to set/change the default MaxHeapSize
allowed or set/change default arguments for any jvm calls?
JAVA_TOOL_OPTIONS
from the answer below worked for me:
# echo $JAVA_TOOL_OPTIONS
-Xmx10g
# java -XX:+PrintFlagsFinal -version | grep MaxHeapSize
Picked up JAVA_TOOL_OPTIONS: -Xmx10g
size_t MaxHeapSize = 10737418240 {product} {command line}
答案1
得分: 2
你可以通过 JAVA_TOOL_OPTIONS 环境变量设置 JVM 参数,例如:
JAVA_TOOL_OPTIONS=-Xmx10g
英文:
You may set JVM arguments via JAVA_TOOL_OPTIONS environment variable, e.g.
JAVA_TOOL_OPTIONS=-Xmx10g
答案2
得分: 1
以下是翻译好的内容:
解决您遇到的问题的简便方法是创建一个批处理文件(类型和实现取决于平台)。批处理文件应该执行Java,您可以从Python中执行批处理文件。
英文:
The easy way to get around the issues you are having is to create a batch file (type and implementation depends on platform). The batch file should execute Java, and you can execute the batch file from python
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论