JRE 1.7 - java版本 - 返回:java / lang / NoClassDefFoundError:java / lang / Object [英] JRE 1.7 - java version - returns: java/lang/NoClassDefFoundError: java/lang/Object
问题描述
当运行任何java应用程序或只是'java'时,jvm失败:
When running any java application, or just 'java', the jvm fails:
VM初始化期间发生错误
java / lang / NoClassDefFoundError:java / lang / Object
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
这是错误的列表答案:
-
正确的Java主目录,包括/ bin目录,位于全局PATH
The correct Java home directory, including the /bin directory, is on the global PATH
JAVA_HOME设置正确
JAVA_HOME is set correctly
执行命令java -fullversion工作
Executing the command java -fullversion works
$ java -fullversion
./java full version "1.7.0_05-b05"
/ usr / java中的符号链接都指向正确的java安装
The symbolic links in /usr/java all point to the correct java installation
我在创建系统时没有安装任何'默认'java
I did not install any 'default' java when I created the system
java -version
失败...与上面相同的错误
java -version
fails...same error as above
从java安装的目录结构下发出命令无法正常工作
Issuing the commands from under the directory structure of the java installation does not work either
对于64位
$ b这是64位java
$ b
任何想法?
Any ideas?
推荐答案
此问题源于不正确的Java安装。
This problem stems from an improper Java installation.
注意:此方案仅适用于Java 8及更早版本。从Java 9开始,JRE的结构不同。 rt.jar和朋友不再存在,并且不再使用Pack200。
NOTE: This scenario only applies to Java 8 and prior. Beginning with Java 9, the JRE is structured differently. rt.jar and friends no longer exist, and Pack200 is no longer used.
Java标准库包含在各种JAR中,例如as rt.jar
, deploy.jar
, jsse.jar
Pack200 压缩并存储as rt.pack
, deploy.pack
, jsse.pack
等等。Java安装程序应该解压缩它们。如果您遇到此错误,显然没有发生。
The Java standard library is contained in various JARs, such as rt.jar
, deploy.jar
, jsse.jar
, etc. When the JRE is packaged, these critical JAR files are compressed with Pack200 and stored as rt.pack
, deploy.pack
, jsse.pack
, etc. The Java installer is supposed to uncompress them. If you are experiencing this error, apparently that didn't happen.
您需要手动运行 .pack上的/8/docs/technotes/tools/unix/unpack200.html\"rel =nofollow noreferrer> unpack200
JRE的 lib /
和 lib / ext /
文件夹中的文件。
You need to manually run unpack200
on all .pack
files in the JRE's lib/
and lib/ext/
folders.
解压缩一个 .pack
文件(例如 rt.pack
),运行:
To unpack one .pack
file (for example rt.pack
), run:
"%JAVA_HOME%\bin\unpack200" -r -v rt.pack rt.jar
要从JRE根运行中递归解压所有 .pack
文件:
To recursively unpack all .pack
files, from the JRE root run:
for /r %f in (*.pack) do "%JAVA_HOME%\bin\unpack200.exe" -r -q "%f" "%~pf%~nf.jar"
* nix
解包一个 .pack
file(例如 rt.pack
),ru n:
*nix
To unpack one .pack
file (for example rt.pack
), run:
/usr/bin/unpack200 -r -v rt.pack rt.jar
以递归方式解压所有 .pack
文件,来自JRE根运行:
To recursively unpack all .pack
files, from the JRE root run:
find -iname "*.pack" -exec sh -c "/usr/bin/unpack200 -r -q {} \$(echo {} | sed 's/\(.*\.\)pack/\1jar/')" \;
可能性2
您以其他方式错误地安装了Java。也许您安装时没有管理员权限,或者只是尝试从安装程序中提取文件。尝试再次使用安装程序和/或更多权限。或者,如果您不想使用安装程序,请使用 .tar.gz
Java包。
这篇关于JRE 1.7 - java版本 - 返回:java / lang / NoClassDefFoundError:java / lang / Object的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!