0

I made an executable jar file that works perfectly for me, but when I send it to my friend, they get the error A JNI error has occurred, please check your installation and try again. When they run it in the console, the extended error message is

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/pathto/project
  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
JackElia
  • 140
  • 9

1 Answers1

-1

This problem is caused when the jar file was compiled in a newer version of java than the person who is running the jar has (E.g. you compiled the jar in Java 11 but your friend only has Java 8 installed.) This can be fixed by having your friend update Java by going to https://www.oracle.com/java/technologies/downloads/#jdk17-windows, and downloading x64 Installer. Then, have your friend install java by running the downloaded exe. Next go to where the exe installed the JDK, default is C:\Program Files\Java, and copy the filepath to the newly downloaded JDK (C:\Program Files\Java\jdk-17.0.1). Finally, go to edit the system environtment variables in control panel, go to Environment Variables... Click on Path under System Variables, click the Edit button, Click the New Button, paste in the filepath you copied, click OK, then move the newly created variable to the top.

JackElia
  • 140
  • 9