Problem :
[root@jony source]# sh run.sh
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.
Getting this error.
What have I done?
Downloaded the right version of Jre/jdk.
rpm -ivh jdk-7u15-linux-x64.rpm
rpm -ivh lolo.rpm (Its jre-7u13-linux-x64 rpm file)
cd source
sh run.sh
All logs of what i’ve done:
[root@jony ~]# rpm -ivh lolo.rpm
Preparing... ########################################### [100%]
1:jre ########################################### [100%]
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jre1.7.0_15/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jre1.7.0_15/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jre1.7.0_15/lib/charsets.pack
localedata.jar...
Error: Could not open input file: /usr/java/jre1.7.0_15/lib/ext/localedata.pack
[root@jony ~]# rpm -ivh jdk-7u15-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/charsets.pack
tools.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/lib/tools.pack
localedata.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/ext/localedata.p ack
[root@jony ~]# cd source
[root@jony source]# sh run.sh
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.
[root@jony source]# rpm -qa | grep -i jre
jre-1.7.0_13-fcs.x86_64
jre-1.7.0_15-fcs.x86_64
[root@jony source]# rpm -qa |grep -i jdk
jdk-1.7.0_11-fcs.x86_64
jdk-1.7.0_15-fcs.x86_64
[root@jony source]# rpm -e daniel.rpm
error: package daniel.rpm is not installed
[root@jony source]# rpm -e jre
error: "jre" specifies multiple packages:
jre-1.7.0_13-fcs.x86_64
jre-1.7.0_15-fcs.x86_64
[root@jony source]# rpm -e jre.1.7.0_15.i586
error: package jre.1.7.0_15.i586 is not installed
[root@jony source]# rpm -e lolo
error: package lolo is not installed
[root@jony source]# jre -e daniel
-bash: jre: command not found
[root@jony source]# rpm -e jre daniel
error: "jre" specifies multiple packages:
jre-1.7.0_13-fcs.x86_64
jre-1.7.0_15-fcs.x86_64
error: package daniel is not installed
[root@jony source]# cd root
-bash: cd: root: No such file or directory
[root@jony source]# cd
[root@jony ~]# rpm -e jre.1.7.0_15.i586
error: package jre.1.7.0_15.i586 is not installed
[root@jony ~]# rpm -e daniel
error: package daniel is not installed
[root@jony ~]# rpm -qa | grep -i jre/jdk
[root@jony ~]# rpm -ivh lolo.rpm
Preparing... ########################################### [100%]
package jre-1.7.0_15-fcs.x86_64 is already installed
[root@jony ~]# cd source
[root@jony source]# sh run.sh
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.
[root@jony source]# cd
[root@jony ~]# rpm -qa | grep -i jre/jdk
[root@jony ~]# rpm -qa | grep -i daniel
[root@jony ~]# rpm -qa | grep -i lolo
[root@jony ~]# rpm -ivh lolo.rpm
Preparing... ########################################### [100%]
package jre-1.7.0_15-fcs.x86_64 is already installed
[root@jony ~]# rpm -e jdk-1.7.0_11-fcs
[root@jony ~]#
[root@jony ~]# rpm -e jdk-1.7.0_15-fcs
[root@jony ~]# rpm -qa | grep -i jdk
[root@jony ~]# rpm -qa | grep -i jre
jre-1.7.0_13-fcs.x86_64
jre-1.7.0_15-fcs.x86_64
[root@jony ~]# rpm -e jre-1.7.0_13-fcs
[root@jony ~]# rpm -e jre-1.7.0_15-fcs
[root@jony ~]# rpm -ivh lolo.rpm
Preparing... ########################################### [100%]
1:jre ########################################### [100%]
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jre1.7.0_15/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jre1.7.0_15/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jre1.7.0_15/lib/charsets.pack
localedata.jar...
Error: Could not open input file: /usr/java/jre1.7.0_15/lib/ext/localedata.pack
[root@jony ~]# rpm -ivh jdk-7u15-linux-x64.rpmjdk-7u15-linux-x64.rpm
error: open of jdk-7u15-linux-x64.rpmjdk-7u15-linux-x64.rpm failed: No such file or directory
[root@jony ~]# rpm -ivh jdk-7u15-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/charsets.pack
tools.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/lib/tools.pack
localedata.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_15/jre/lib/ext/localedata.p ack
[root@jony ~]# cd source
[root@jony source]# sh run.sh
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.
[root@jony source]# ^C
[root@jony source]#
What did I do wrong?
Running on centOS 6.x
Solution :
Try downloading the JDK in “tar.gz”.
Extract the content of your tar.gz to a folder in which you want to have your java installation, example:
tar xvf myJava7.tar.gz
Then, set your JAVA_HOME variable and update the references, to update your references, please do the following:
sudo update-alternatives --install "/usr/bin/javac" "javac" "/path/where/i/extracted/usr/lib/jvm/java7/bin/javac" 1
sudo update-alternatives --config javac
It is better when you use your tar files, you can specify and make your installation of Java or any other component more flexible.
Best regards.
You’re trying to allocate more memory to the Java VM’s heap than you have available. Look at the shell script and see what the arguments are that are being passed to Java.
The arguments to look for are:
- -Xms – minimum
- -Xmx – maximum
You should run the JVM with:
-XX:MaxHeapSize=256m -Xmx512m
You can change both numbers at will, but do make sure that the heap size is large.
[root@centos57 ~]# echo $JAVA_HOME
/java/jdk1.7.0_11
Also run:
java -version
to see what’s installed.
A similar output is what you should see – if not, it isn’t recognizing the JDK as being referenced. Also if the _13
is shown before the _15
you need to move the order.
If all of that fails run:
yum remove java
and reinstall.
Here’s a link that might help, I use it: https://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/