7
votes

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
4

4 Answers

15
votes

Remove the space after Xmx and Xms

-1
votes

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

-2
votes

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.

-2
votes

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.