• Register
1 vote
28 views

Problem:

I kept on getting this error when building for Android (shadow demo):

Building DEX Failed!
G:\Unity\JavaPluginSample\Temp/StagingArea> java -Xmx1024M
-Djava.ext.dirs="G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/"
-jar "G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/dx.jar"
--dex --verbose --output=bin/classes.dex bin/classes.jar plugins
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

How to solve this?

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

1 vote

Answer:

This is usually caused by a bad version of Java being installed on your machine.
Try updating your Java install to the latest version and this will generally solve this issue.

or you can try it :

Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System Variables->New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
Variable name: Path
Variable value: ;C:\Program Files\Java\jre6\bin;F:\JDK\bin;
Change this to your appropriate path.

Hope this helps you.

11 6 4
34,950 points

Related questions

0 votes
1 answer 41 views
41 views
Why i am seeing this error can someone give me some explanation "Could not reserve enough space for object heap"” and how to resolve this issue.
asked Sep 14, 2020 Daniel Anderson 4k points
0 votes
0 answers 11 views
1 vote
1 answer 25 views
25 views
Problem: I am getting this error when I tried to build shadow demo for android: Building DEX Failed! G:\Unity\JavaPluginSample\Temp/StagingArea> java -Xmx1024M -Djava.ext.dirs="G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/" -jar "G:/AndroidSDK/android- ... reserve enough space for object heap Could not create the Java virtual machine. Can anybody help to fix or explain me this error
asked Mar 24, 2020 LizzyM 6.1k points
0 votes
1 answer 27 views
27 views
i have come across the Minecraft could not reserve enough space for object heap. How to fix could not reserve enough space for object heap Minecraft?
asked Dec 6, 2020 TeamScript 13.5k points
0 votes
1 answer 8 views
8 views
How can I eliminate this error?
asked Feb 9 TeamScript 13.5k points
0 votes
1 answer 9 views
9 views
Problem: I have Java7 running on 32-bit Windows and 4 GB RAM, but: java -Xmx4G -Xms4G -jar Minecraft.jar java -Xmx3G -Xms3G -jar Minecraft.jar java -Xmx2G -Xms2G -jar Minecraft.jar still does not work. Error:
asked Feb 1 Ali 4.4k points
0 votes
1 answer 140 views
140 views
Problem : I am having a box with 8gb of ram, so I don't think the total memory is the issue. This application is running properly on boxes with 6gb or less ram. What I am trying to do is to reserve 3GB of space using -Xmx3G command under "VM ... : Error occurred during initialization of VM; Could not reserve enough space for object heap using -Xmx3G Why am I getting such error any clue?
asked Nov 26, 2019 alecxe 7.5k points
0 votes
1 answer 2 views
2 views
Problem: minecraft could not reserve enough space for object heap java -Xmx4G -Xms4G -jar Minecraft.jar java -Xmx3G -Xms3G -jar Minecraft.jar java -Xmx2G -Xms2G -jar Minecraft.jar
asked 2 days ago Hira 2.2k points
1 vote
1 answer 35 views
35 views
Problem: I have been using java7 on my 32bit windows with 4 RAM and I am getting the messages below while using these codes java -Xmx4G -Xms4G -jar Minecraft.jar java -Xmx3G -Xms3G -jar Minecraft.jar java -Xmx2G -Xms2G -jar Minecraft.jar Error occurred ... Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Why this is happening? Any solution?
asked Mar 6, 2020 Gavin 15.3k points