Kurt Mueller
Kurt Mueller

Reputation: 3224

Setting/changing default Java MaxHeapSize or changing default JVM command settings

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}

Upvotes: 2

Views: 314

Answers (2)

apangin
apangin

Reputation: 98284

You may set JVM arguments via JAVA_TOOL_OPTIONS environment variable, e.g.

JAVA_TOOL_OPTIONS=-Xmx10g

Upvotes: 2

ControlAltDel
ControlAltDel

Reputation: 35011

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

Upvotes: 1

Related Questions