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.
Se você ainda receber o erro durante a inicialização da VM, tente fechar alguns aplicativos que estão sendo executados em segundo plano e tente novamente. Também existe a possibilidade de a memória física ser muito baixa para executar a VM.
Outro problema de servidor que você pode encontrar é o Io.Netty.Channel.Abstractchannel no Minecraft mas este guia irá ajudá-lo.
Para resumir nosso guia, o erro ocorrido durante a inicialização da VM é na verdade um problema com o Java alocando muita memória heap inicial e, a partir dos testes de laboratório do WR, definir os valores mais baixos resolverá o problema rapidamente.
Você pode fazer isso executando um comando do prompt de comando, editando o arquivo em lote ou executando um comando Bash.
Se você receber o erro de conexão com a Internet no Minecraft, acesse o guia destacado para corrigir o problema rapidamente.
Para quaisquer outras sugestões e soluções testadas, vá para a seção de comentários abaixo e deixe-nos uma mensagem.
Deixe um comentário