[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.
收到此错误。
我做了什么?
下载正确版本的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
我所做过的所有事情的日志:
[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]#
我做错了什么?
在 centOS 6.x 上运行
答案1
尝试以“tar.gz”格式下载 JDK。
将 tar.gz 的内容解压到您想要安装 Java 的文件夹中,例如:
tar xvf myJava7.tar.gz
然后,设置您的 JAVA_HOME 变量并更新引用,要更新您的引用,请执行以下操作:
sudo update-alternatives --install "/usr/bin/javac" "javac" "/path/where/i/extracted/usr/lib/jvm/java7/bin/javac" 1
sudo update-alternatives --config javac
当您使用 tar 文件时,您可以指定并使 Java 或任何其他组件的安装更加灵活。
此致。
答案2
您试图为 Java VM 的堆分配比可用内存更多的内存。查看 shell 脚本并查看传递给 Java 的参数是什么。
要寻找的参数是:
- -Xms – 最小
- -Xmx – 最大值
答案3
您应该使用以下命令运行 JVM:
-XX:MaxHeapSize=256m -Xmx512m
您可以随意更改这两个数字,但一定要确保堆大小很大。
答案4
[root@centos57 ~]# echo $JAVA_HOME
/java/jdk1.7.0_11
同时运行:
java -version
查看已安装的内容。
您应该会看到类似的输出 - 如果没有,则表示它未识别出所引用的 JDK。此外,如果_13
显示在 之前,则_15
需要移动顺序。
如果所有这些都失败了,请运行:
yum remove java
并重新安装。
这是一个可能有帮助的链接,我使用它:https://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/