Java Invalid maximum heap size
Asked Answered
T

4

7

I just installed Ubuntu 64Bit on my VServer and JRE build 1.7.0_67-b01. If I want to run a java jar-file it says

Invalid maximum heap size: -Xmx Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.

java -help says

java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

I tried 1M, 256M, 1024M, 2G and 4G for -Xmx, nothing works. Is there a hidden setting I don't know?

Here's the command I use:

java -Xmx 1024M -Xms 1024M -jar MyConverter.jar
Theism answered 7/8, 2014 at 19:32 Comment(1)
javarevisited.blogspot.in/2012/12/…Prolongate
S
16

Remove the space after Xmx and Xms

Silencer answered 7/8, 2014 at 19:33 Comment(1)
Thank you, I got this command from a tutorial. Now it works! :)Theism
M
0

If you need to use more than 2G (say 4G with this switch: -Xmx4096m) make sure you have JRE for Windows x64 installed.

Microorganism answered 15/8, 2021 at 4:22 Comment(0)
R
-1

I had a case related with incompatible line ending between Windows an Linux. So, if nothing helps, be sure your don't copied file from Windows.

Rangefinder answered 16/1, 2017 at 13:49 Comment(0)
C
-2

Check your RAM of machine. xmx shout be half of your RAM. Also, xms is jvm heap size at starting whereas xmx is maximum heap size during jvm life cycle. It also depends on how much memory your application going to take during execution.

Chirpy answered 7/8, 2014 at 19:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.