Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA invalid maximum heap size. The specified size exceeds the maximum representable size

Tags:

java

I have to run this command to fix the code to a xml file:

java -Xmx5G -cp .:jsoup-1.8.2.jar CheckSyntax test.xml > test2.xml

But it gives me this error:

Invalid maximum heap size: -Xmx5G
The specified size exceeds the maximum representable size.

How can I make it work?

like image 596
K0pp0 Avatar asked Jul 01 '15 22:07

K0pp0


People also ask

How do I fix invalid max heap size?

64 bit JVM installed on Solaris machines runs with a 32-bit model if you don't specify either -d32 or -d64, which won't accept a Maximum heap size of 4GB, hence "invalid heap size". You can resolve this issue by running Solaris JVM with option -d64.

What is the maximum representable size Java?

The approximate Maximum heap size for a 32-bit JVM on a 64-bit Operating system can be 3.7GB.

What is the maximum heap size for 64 bit JVM?

For 64 bit platforms and Java stacks in general, the recommended Maximum Heap range for WebSphere Application Server, would be between (4096M - 8192M) or (4G - 8G).


2 Answers

If your JVM is 32-bit you cannot use the switch -d64

like image 138
Sivakumar Avatar answered Sep 20 '22 14:09

Sivakumar


java -Xmx2G -cp .:jsoup-1.8.2.jar CheckSyntax test.xml > test2.xml

32 bit java cant use heapsize > 2G

like image 43
Jacek Pietal Avatar answered Sep 19 '22 14:09

Jacek Pietal