title: JNI error : A class has been compiled by a more recent version of the Java Runtime
body: <p>I have a MyFirstProgram.java file that contains two classes. I just modified the Path and tried to test the file with <code>java</code> and<code>javac</code>.</p>
  
  <pre><code>public class MyFirstProgram{
      public static void main(String[] args){
          System.out.println("Hello ! World :)");
      }
  }
  </code></pre>
  
  <p>However, it returns me:</p>
  
  <pre><code>C:\Users\antoi\Documents\Programming\Julien&gt;java MyFirstProgram.java
  Error: Could not find or load main class MyFirstProgram.java
  
  C:\Users\antoi\Documents\Programming\Julien&gt;javac MyFirstProgram.java
  'javac' is not recognized as an internal or external command,
  operable program or batch file.
  </code></pre>
  
  <p>Here is the Path:</p>
  
  <p><a href="https://i.stack.imgur.com/vOvVI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vOvVI.png" alt="introducir la descripción de la imagen aquí"></a></p>
  
  <p>It only works when I call javac directly in the folder:</p>
  
  <pre><code>C:\Users\antoi\Documents\Programming\Julien&gt;"C:\Program Files\Java\jdk-11.0.2\bin\javac" MyFirstProgram.java
  
  C:\Users\antoi\Documents\Programming\Julien&gt;java MyFirstProgram
  Error: A JNI error has occurred, please check your installation and try again
  Exception in thread "main" java.lang.UnsupportedClassVersionError: MyFirstProgram 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(Unknown Source)
          at java.security.SecureClassLoader.defineClass(Unknown Source)
          at java.net.URLClassLoader.defineClass(Unknown Source)
          at java.net.URLClassLoader.access$100(Unknown Source)
          at java.net.URLClassLoader$1.run(Unknown Source)
          at java.net.URLClassLoader$1.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
  </code></pre>
  
  <p>Yet it can't display the message <code>java</code> and reveals there is an <code>UnsupportedClassVersionError</code>. I understand from other posts it is my Java Runtime Environnment for <code>javac</code> that might not be in accordance to the <code>java</code> command. What steps to follow so that I can print the Hello World message ?</p>