Solved: Error Occurred During Initialization of VM
The java initial memory heap is too high
- To fix the Error occurred during initialization of VM, run the java -Xms256m -Xmx512M line in 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!
The error occurred during initialization of VM is a classic Java issue when you are trying to run VM. The error message can appear on any system you try to launch a virtual machine, including Windows, Mac, or Linux.
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
How do I fix error occurred during initialization of VM?
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 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.
1. Change the Java heap size using Command Prompt
- Click the Start button, type cmd, and click on Run as administrator from the results.
- 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
- Press the Win + E shortcut to start File Explorer.
- Locate and edit the .bat file of the server you want to run.
- 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 32bit version will not handle the 2 Gb memory it’s trying to allocate.
3. Run a Bash command
- Log into another session of your server and go to Bash to run a Java command.
- Type or paste the following command and press Enter:
-bash – 3.3$ export _JAVA_OPTIONS = ” – Xmx256M”
- To make sure, run the following command to see if you have changed the Java setting:
-bash – 3.3$ javac HelloWorldApp.java
- 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.
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 the 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.