question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

code runner broken, missmatch between compiler & runner

See original GitHub issue

[provide a description of the issue] I have no problem using the java & javac command in my terminal to compile and run the code, but when running inside VSCode it messes up, it throws error described under section Current Result

Environment
  • Operating System: macOS Sierra, 10.12.6
  • JDK version: java version “1.8.0_202”
  • Visual Studio Code version: 1.31.1
  • Java extension version: 0.4.0
Steps To Reproduce
  1. install java8 with home brew
  2. install the java extention pack in vscode
  3. make a simple hello world
  4. press the run code in vscode

[attach a sample project reproducing the error] Simple project running this code:

public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, world");
  }
}
Current Result
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWorld has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
Expected Result

“Hello, world”

Additional Informations

Im pretty new to Java development, so i might also have messed something up. Here is a bit more information about my setup on the mac hopefully this can help to sole this issue:

➜  hello-world which java
/usr/bin/java
➜  hello-world ls -l `which java`
lrwxr-xr-x  1 root  wheel  74 24 Nov  2017 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
➜  hello-world echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
➜  hello-world java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
➜  hello-world javac -version
javac 1.8.0_202
➜  hello-world ls -l `which javac`
lrwxr-xr-x  1 root  wheel  75 24 Nov  2017 /usr/bin/javac -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

1reaction
fbriconcommented, Apr 1, 2019

Fix is merged upstream. New 0.42.1 release is imminent. You might need to clean the workspace folders though, after reopening your folder.

0reactions
yaohaizhcommented, Sep 27, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix the top 10 most common compile time errors in Java
Example of an 'unreachable code' error, one of several common Java compile errors. 1. Class and source file mismatch. The name of the...
Read more >
Fatal Error: Mismatch between the program and library build ...
But when I tried to run it, I got: Code: Select all /home/fmc/Desktop/CppStuff/wxWindow_Learning/Fisherman/cmake-build-debug/Fisherman Fatal ...
Read more >
What is a good technique for compile-time detection of ...
What is a good technique for compile-time detection of mismatched preprocessor-definitions between library-code and user-code? Ask Question.
Read more >
Fatal Error C1900 | Microsoft Learn
Il mismatch between 'tool1' version 'number1' and 'tool2' version 'number2'. Tools run in various passes of the compiler do not match.
Read more >
SPEC CPU®2017 Frequently Asked Questions
Run.05 Why did 621.wrf_s abort / hang / get a run time error? I'm using GCC 7. ... Miscompare.04 My compiler is generating...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found