Reserving space for a heap object

0 votes

I was trying to increase the virtual memory and RAM size in my 32-bit cmd shell. But each time I am executing the program, I am getting the below exception:

Error occurred during initialization of VM

Could not reserve enough space for object heap

Could not create the Java virtual machine

Please help me out in eliminating this exception.

May 31, 2018 in Java by v.liyyah
• 1,290 points
91 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

I too encountered this problem and tried resolving it through the command line. But it seems like it doesn’t understand the cmd line options:

-bash-3.2$ javac -Xmx256M HelloWorldApp.java 
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I think here you will have to set the _JAVA_OPTIONS. You can do this by following the below code:

-bash-3.2$ export _JAVA_OPTIONS="-Xmx256M"
-bash-3.2$ javac HelloWorldApp.java 
Picked up _JAVA_OPTIONS: -Xmx256M

answered May 31, 2018 by geek.erkami
• 2,320 points

Related Questions In Java

0 votes
3 answers

Convert date object to a String

We parse the full date to time ...READ MORE

answered Jul 30, 2018 in Java by samarth295
• 2,190 points
43 views
0 votes
3 answers

How to check whether a string is empty or not? Is there a function for this?

str != null && str.length() != 0 alternatively str ...READ MORE

answered Sep 11, 2018 in Java by Sushmita
• 6,820 points
58 views
0 votes
1 answer

How to convert a JSON String into Object in Java?

We can easily convert a JSON String ...READ MORE

answered Jun 8, 2018 in Java by parth295
• 4,590 points
163 views
0 votes
1 answer

Working of Progress Bar for a File Download

Once of the ways to achieve is ...READ MORE

answered Jun 26, 2018 in Java by Rishabh
• 3,520 points
493 views
0 votes
1 answer

how to increase heap size in java?

You can refer the below command: java -Xmx6g ...READ MORE

answered May 29, 2018 in Java by Akrati
• 3,150 points
18 views
0 votes
1 answer

Setting Proxy for JVM usage

To set an HTTP/HTTPS and/or SOCKS proxy ...READ MORE

answered Jun 26, 2018 in Java by Rishabh
• 3,520 points
138 views
0 votes
1 answer

What is the maximum Java heap size of a 32-bit JVM on a 64-bit OS?

32-bit JVMs which expect to have a ...READ MORE

answered Nov 15, 2018 in Java by Frankie
• 9,590 points
299 views
0 votes
1 answer

What are the types of memory in JVM?

The different types of Memory in JVM ...READ MORE

answered Mar 7 in Java by Priyaj
• 56,120 points
52 views
0 votes
1 answer

Replacing a String with a character

Yes, you are missing out on a ...READ MORE

answered May 16, 2018 in Java by geek.erkami
• 2,320 points
16 views
0 votes
1 answer

Retrieving the path of a running jar file

Its quite simple. Try using the below ...READ MORE

answered May 25, 2018 in Java by geek.erkami
• 2,320 points
533 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.