Java Invalid Maximum Heap Size. the Specified Size Exceeds the Maximum Representable Size

Java Invalid Maximum Heap Size. the Specified Size Exceeds the Maximum Representable Size

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?

5

3 Answers

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

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

32 bit java cant use heapsize > 2G

Here is the link to get Java 64bit to allow a larger heap-size. Just select the "Windows Offline (64-bit)" option.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.