Invalid maximum heap size

90,386

Solution 1

You are using 32 bit VM (Java HotSpot(TM) Client VM) which can be mapped to maximum 4G (Only 2 GB in reality) 2^32 address locations Maximum Java heap size of a 32-bit JVM on a 64-bit OS

Error message suggest you are using 5GB heap memory which is not supported on 32 bit architecture

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

Could not create the Java virtual machine.

You can modify the -Xmx parameter to use anythinng <=2g should work here

Solution 2

I just encountered the problem and solved it by downloading the windows 64-bit JAVA.

Please check whether your windows version is 32-bit or 64-bit, and download the right version of JAVA.

Share:
90,386
AlwaysALearner
Author by

AlwaysALearner

Updated on July 15, 2022

Comments

  • AlwaysALearner
    AlwaysALearner almost 2 years

    I have copied a jdk directory from another location. Since then, I get the following error message.

    Your environment has been set.
    java version "1.5.0_22"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
    Java HotSpot(TM) Client VM (build 1.5.0_22-b03, mixed mode, sharing)
    PROPS=-Xms1024m -Xmx5096m -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -Djava.ext.dirs=..;.;..\lib;..\classes -Dfile.encoding=UTF-8
    CLASSPATH=C:\Oracle\MIDDLE~1\patch_wls1211\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\PROGRA~1\Java\JDK15~1.0_2\lib\tools.jar;C:\Oracle\MIDDLE~1\WLSERV~1.1\server\lib\weblogic_sp.jar;C:\Oracle\MIDDLE~1\WLSERV~1.1\server\lib\weblogic.jar;C:\Oracle\MIDDLE~1\modules\features\weblogic.server.modules_12.1.1.0.jar;C:\Oracle\MIDDLE~1\WLSERV~1.1\server\lib\webservices.jar;C:\Oracle\MIDDLE~1\modules\ORGAPA~1.1/lib/ant-all.jar;C:\Oracle\MIDDLE~1\modules\NETSFA~1.0_1/lib/ant-contrib.jar;
    Invalid maximum heap size: -Xmx5096m
    The specified size exceeds the maximum representable size.
    Could not create the Java virtual machine.
    

    Does this mean I will have to re-install the jdk, and not just copy any installation directory? I'm asking this and not trying it out myself because this exercise will have to be done in a client machine.

    The current machine is a Windows 2008 server and has 12GB of RAM.

  • Nisarg Patil
    Nisarg Patil almost 4 years
    I am using 64bit version of java and still getting this error, any reason you know?
  • eel ghEEz
    eel ghEEz almost 2 years
    @NisargPatil, it's possible to execute Java with an argument containing -X options separated by spaces. Then Java will fail to parse this argument.