Iv'e created a small program with GUI that reorders PDF files. I want to share this program with my friends, so I created a .jar file, and with launch4j I converted the .jar file to .exe file. I launched the .exe file on my computer, and the program ran properly.
This is the xml file that was created by launch4j:
enter code here<?xml version="1.0" encoding="UTF-8"?>
-<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>C:\Users\amita_000\Desktop\pdf1\PDF\jar\PDFReorder.jar</jar>
<outfile>C:\Users\amita_000\Desktop\pdf1\PDF\PDFReorder.exe</outfile>
<errTitle/>
<cmdLine/>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl/>
<stayAlive>false</stayAlive>
<manifest/>
<icon>C:\Users\amita_000\Desktop\pdf1\PDF\pdf-512.ico</icon>
-<jre>
<path/>
<bundledJre64Bit>false</bundledJre64Bit>
<minVersion>1.5.0</minVersion>
<maxVersion/>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
</jre>
</launch4jConfig>
Now I created a installer with NSIS, that installs the executable file into the computers "Program Files" directory.
When i install the program on a different computer I succeed installing, but when I tried running the program I get a java virtual machine launcher error:
a java exception has occurred
This is the error log:
Exception in thread "main" java.lang.UnsupportedClassVersionError: PDF_Reorder/Main : Unsupported major.minor version 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)
How can i fix this problem so that this program can be installed and run on any computer?
A version error suggests a mismatch between then compiler version used to compile the code and the JRE used to run it.
Version 52 corresponds to Java 8, whereas you've specified any JRE of 1.5 upwards.
I'd build your code with the lowest version thats compatible with whatever language features you use.