33

I'm trying to use visual studio code for Java.

Have installed the extensions for Java, and have a 1.8 JDK installed with environment variable pointing to the install.

When starting debugger with a simple hello world program, I get the following:

java.lang.UnsupportedClassVersionError: HelloWorld has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) ...... ...... at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

Any help with getting Java debugging in Visual Studio code appreciated.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Dave Jones
  • 331
  • 1
  • 3
  • 3

1 Answers1

30

You are probably compiling (or using dependencies compiled) with java 9, but still using JDK 8.0

Install java 9 and change your OS environment settings to point to the new JDK. This should solve your problem.

Roeland Van Heddegem
  • 1,623
  • 2
  • 20
  • 35