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

Im running Eclipse Juno on Mac OSX 10.8.4, I tried to upgrade my jdk to 1.7 when I run a Java application, and I have this error:

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

if i run terminal

 java -version 

I get it

 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) 

to update this option installed on Eclipse

Window - Settings - Java - Installed JRE - Duplicate

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

also changed the compiler level

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

The following lines have also been added to /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 the same error

Any help I would appreciate

+6
source share
3 answers

in your startup configuration, make sure the right JRE system library is in the Classpath

+6
source

Have you added JAVA_HOME to your PATH? Usually you get this problem due to poor installation of the SDK. Try

 javac -version 

From the command line and see if it differs from

 java -version 

And creates the same NoClassDefFoundError as above.

+1
source

The most likely cause of java/lang/NoClassDefFoundError is that you have a jar in your class path that references another jar that is not in the pathpath. Link classes will not be initialized.

Now for your case you have updated to 1.7, which would add dependencies. Make sure your classpath now refers to jdk / jre 1.7

+1
source

Source: https://habr.com/ru/post/955944/


All Articles