Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Error: A JNI error has occurred, please check your installation and try again

Alguma luz?

D:\curso_java_alura\java-codigo>java Programa
Erro: Não foi possível localizar nem carregar a classe principal Programa

D:\curso_java_alura\java-codigo>java -version
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)

D:\curso_java_alura\java-codigo>javac -version
javac 13.0.2

D:\curso_java_alura\java-codigo>echo %PATH%
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;
C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\dotnet\;
C:\Program Files\Java\jdk1.8.0_231\bin;C:\Program Files\nodejs\;
C:\composer;C:\Program Files\Git\cmd;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;
C:\Users\fb\AppData\Local\Microsoft\WindowsApps;
C:\Users\fb\.dotnet\tools;C:\Users\fb\AppData\Local\Programs\Microsoft VS Code\bin; C:\Users\fb\AppData\Local\GitHubDesktop\bin;
C:\xampp\php; C:\Program Files\Java\jdk-13.0.2\bin;
C:\Users\fb\AppData\Roaming\npm;C:\Users\fb\AppData\Roaming\Composer\vendor\bin;;C:\Program Files\Docker Toolbox

D:\curso_java_alura\java-codigo>java -cp . Programa
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: Programa has been compiled by a more recent version of the Java Runtime (class file version 57.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)

D:\curso_java_alura\java-codigo>
2 respostas
solução!

Olá Fabiana,

poderia tbm postar a classe utilizada? =)

Pode ser tbm que vc esteja com mais de uma instalação do Java rodando em sua máquina.

Programa has been compiled by a more recent version of the Java Runtime (class file version 57.0)

Tente compilar novamente.

Obrigada. Eu realmente tinha java (versoes diferentes) instalado antes. Desinstalei tudo, refiz o path e funcionou.