3

Each time I try to launch java.exe, in this case java.exe -version, I get this output:

Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

Here is a screenshot of my problem:

enter image description here

I searched on Google for a solution but nothing works...

Pshemo
  • 122,468
  • 25
  • 185
  • 269
  • 1
    Did you try reinstalling Java? – Carcigenicate Oct 12 '16 at 13:37
  • 2
    "Nothing works" is not a problem statement we can help with. Sorry. What version of java have you installed, how did you install, ... a ton of things that might matter here. – GhostCat Oct 12 '16 at 13:38
  • It could be result of improper Java installation. This link address some of the causes might come handy http://stackoverflow.com/questions/11808829/jre-1-7-returns-java-lang-noclassdeffounderror-java-lang-object – mhasan Oct 12 '16 at 13:41
  • Thank you all! I've solved it by setting the JAVA_HOME to the JRE, not the JDK! – Kees van Voorthuizen Oct 12 '16 at 15:08

3 Answers3

2

Make sure your JAVA_HOME environment variable is set to fully qualified path of the directory that contains bin/java.exe

Joe Kampf
  • 339
  • 2
  • 8
1

Just Delete java.exe in c:/programdata/oracle/java/javapath_target_xxxxxx/

vinuales
  • 31
  • 2
  • I’m sorry, but this answer has already been answered a year ago. Thanks for your answer, though. – Kees van Voorthuizen Jan 22 '18 at 12:28
  • That's a good answer. solve my problem. when i reinstall the jdk1.8.0_172, The same error was arisen. my JAVA_HOME is correct, then find and delete java.exe in javapath_target_xxxxx. the error is disappear. – kookob May 17 '18 at 06:19
0

Make sure your installed java bin directory contains rt.jar

S.Roshanth
  • 1,499
  • 3
  • 25
  • 36