简体   繁体   English

java / lang / NoClassDefFoundError:java / lang / invoke / MethodHandle eclipse juno

[英]java/lang/NoClassDefFoundError: java/lang/invoke/MethodHandle eclipse juno

Im running Eclipse Juno on Mac OSX 10.8.4, I tried to update my jdk to 1.7 when I run my Java App and I have this error: 我在Mac OSX 10.8.4上运行Eclipse Juno,当我运行Java App时,我试图将我的jdk更新为1.7,我有这个错误:

Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/invoke/MethodHandle

if I run on terminal 如果我在终端上运行

java -version

I get this 我明白了

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

for updating this I set on Eclipse 为了更新这个我在Eclipse上设置

Window - Preferences - Java - Installed JREs - Duplicate 窗口 - 首选项 - Java - 已安装的JRE - 重复

JRE home: /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home
JRE name: Java SE 7 (MacOS X Default)

also changed compiler level 也改变了编译器级别

Window - Preferences - Java - Compiler - Compiler compilance level: 1.7

also added next lines to /Users/myUser/.bash_profile: 还在/Users/myUser/.bash_profile中添加了下一行:

VA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home

export JAVA_HOME=$VA_HOME
export CLASSPATH=$VA_HOME
export PATH=$PATH:$JAVA_HOME/bin

but still getting same error 但仍然得到同样的错误

Any help I'll appreciate 任何帮助,我会很感激

在启动配置中,检查正确的JRE系统库是否在Classpath上

Have you added JAVA_HOME to your PATH? 你有没有把JAVA_HOME添加到你的PATH? Usually you get this problem due to a bad installation of the SDK. 通常,由于SDK安装不当,您会遇到此问题。 Try 尝试

javac -version

From the command line and see if this differs to 从命令行查看是否有所不同

java -version

And produces the same NoClassDefFoundError as above. 并产生与上面相同的NoClassDefFoundError。

The most probable reason of java/lang/NoClassDefFoundError is that you have a jar in your classpath which references another jar which is missing in classpath. java/lang/NoClassDefFoundError最可能的原因是你的类路径中有一个jar,它引用了classpath中缺少的另一个jar。 The referencing classes won't be initialized. 引用类不会被初始化。

Now for your case, you upgraded to 1.7 which would have added dependencies. 现在针对您的情况,您已升级到1.7,这将添加依赖项。 Make sure your classpath now refers to jdk/jre 1.7 确保您的类路径现在引用jdk / jre 1.7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM