Solved: Error Occurred During Initialization of VM

The java initial memory heap is too high

Reading time icon 4 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Key notes

  • To fix the Error occurred during initialization of VM, run the java -Xms256m -Xmx512M line in the Command Prompt.
  • You may also edit the batch file or run a simple bash command to fix this issue quickly.
  • Read below to find the detailed instructions brought by our Windows Report software team!
How to fix the error occurred during initialization of VM

The error occurred during initialization of VM is a classic Java issue when you are trying to run the VM. The error message can appear on any system you try to launch a virtual machine, including Windows, Mac, or Linux.

This issue occurs because the JVM allocates a big chunk of initial heap memory from the system that Windows or other OSes can’t provide. So, even if you have 8GB of RAM, if it’s already in use and the heap size is too big, you will see the error during the initialization of the VM.

Restart your PC and try to run Java before the other programs initialize, and make sure you’re running a 64-bit JVM. The 32-bit version can’t use more than 1.5 GB of RAM.

How do I fix error occurred during initialization of VM?

1. Change the Java heap size using Command Prompt

  1. Click the Start button, type cmd, and click on Run as administrator from the results.
  2. Type or paste the following command and press Enter: java -Xms256m -Xmx512M

This command will set the Java Xms initial heap memory to a lower value, and now you can initialize VM without any issues.

From our tests in the WR labs, this solution worked in all situations to fix the VM initialization error. However, you can also apply the solutions below for the same effect.

2. Change the variables in the batch file

  1. Press the Win + E shortcut to start File Explorer.
  2. Locate and edit the .bat file of the server you want to run.
  3. Now, change the Xms and Xmx values in the file with lower ones. For instance, -Xms256M -Xmx512M. You can go even higher, depending on the actual RAM you have.

If you go too high with the virtual memory values, Java will display a Could not reserve enough space for object heap error.

This simple solution will work on the Could not reserve enough space for 2097152kb object heap error. But for this one, you should check if you’re using a 32-bit JVM. As we’ve mentioned above, the 32-bit version will not handle the 2 GB memory it’s trying to allocate.

3. Run a Bash command

  1. Log into another session of your server and go to Bash to run a Java command.
  2. Type or paste the following command and press Enter: -bash โ€“ 3.3$ export _JAVA_OPTIONS = โ€ โ€“ Xmx256Mโ€
  3. To make sure, run the following command to see if you have changed the Java setting: -bash โ€“ 3.3$ javac HelloWorldApp.java
  4. If you get the message Picked up _JAVA_OPTIONS: โ€“ Xmx256M, you are fine.

If you still get the error occurred during initialization of VM, try closing some apps that are running in the background and try again. There is also the possibility that the physical memory is too low to run the VM.

Here are some of the error instances found by our Windows Report software experts:

  • Error occurred during initialization of VM noclassdeffounderror java/lang/object.
  • Error occurred during initialization of VM Minecraft server – The Minecraft server could not reserve enough memory to run.
  • Error occurred during initialization of VM Could not reserve enough space for object heap

Another server problem you might encounter is the Io.Netty.Channel.Abstractchannel on Minecraft but this guide will help you.

To sum up our guide, the error occurred during initialization of VM is actually a problem with Java allocating too much initial heap memory, and from the WR lab tests, setting the values lower will fix the problem quickly.

You can do that by running a Command Prompt command, by editing the batch file, or by running a Bash command.

If you get an internet connection error in Minecraft, hit the highlighted guide to fix the problem quickly.

We also have a special guide that can help you resolve Coredump target configuration issues effectively, so don’t miss it.

For any other suggestions and tested solutions, go to the comments section below and drop us a note.

More about the topics: memory issues, server, vmware