Skip to content
Advertisement

Setting Java Heap Size under Apache Karaf

I apologize if this is a duplicate, but I can’t seem to find this answered anywhere.

What is the best way to increase the maximum Java heap size when using Apache Karaf?

Currently, I modified the following line in the karaf.bat file:

set DEFAULT_JAVA_OPTS=-server -Xmx<NewMaxValue>M.

I feel like modifying the bat file is not the best solution. Additionally, none of the config files seem to have a place to put this.

Thanks

Advertisement

Answer

Updating to Karaf 2.2.3 reveals a new bat file.

if "%JAVA_MIN_MEM%" == "" (
    set JAVA_MIN_MEM=128M
)

if "%JAVA_MAX_MEM%" == "" (
    set JAVA_MAX_MEM=512M
)

if "%JAVA_PERM_MEM%" == "" (
    set JAVA_PERM_MEM=16M
)

if "%JAVA_MAX_PERM_MEM%" == "" (
    set JAVA_MAX_PERM_MEM=64M
)

This means one can just create a system variable instead of modifying the bat file.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement