Forum Discussion

wantorp2's avatar
wantorp2
Occasional Contributor
7 years ago

Error: Could not create the Java Virtual Machine.

Hi,

 

I run my api tests using testrunner.bat commands by the cmd.exe, but I always get the following error in the tests.

 

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

 

Does anyone have the same problem?

 

Thanks,

 

Best regards

 

 

2 Replies

  • warnerwanton's avatar
    warnerwanton
    Occasional Visitor

    There is not enough virtual memory space requested by an application thus the application fails to start. This usually happens during the application startup phase. Applications reserve a large amount of virtual memory for the JVM heap space during the startup phase. Java on Windows uses an initial size of 16 Megabyte and a maximum of 64 Megabyte.

     

    Most of the time you can fix this problem by uninstalling the Java runtime and then reinstalling it all over again. You can also try increasing the amount of system memory allocated to the Java virtual machine by setting an environment variable.

     

    Open the Control Panel
    Go to System
    Go to Advanced Systems Properties
    Then Environment Variables
    In System Variables, click Add
    New Variable Name: _JAVA_OPTIONS
    New Variable Value: -Xmx512M
    Click OK