0

I'm back for about the second time this week and third in the past two with more issues. I'm so sorry.

Jpackage creates my app image fine, ( i got this msg thru --win-console) but upon running it through cmd, we get here.

Error: LinkageError occurred while loading main class Chimera.tech.Main
    java.lang.UnsupportedClassVersionError: Chimera/tech/Main has been compiled by a more 
recent version of the Java Runtime (class file version 58.0), 
this version of the Java Runtime only recognizes class file versions up to 55.0

I am (allegedly) on the Oracle JDK 14 and attempting to use Jpackage. It keeps giving me warnings about "incubator modules" which I'm not still sure the meaning of. Finalized command used:

I'm generating an app image, (which I'm then told can be used to make an installer) which I am also still not sure on the meaning of. Is it a standalone app by itself?

Questions about the technicalities of jpackage aside, this program was made in IntelliJ originally as Java 11 until I switched to 14 for jpackage. My system environment variables look fine: PATH is the path to the bin of my jdk 14, as is JAVA_HOME, and "Path" has %JAVA_HOME%\bin inside. I've gleaned that version 55 is 11 and version 58 is 14, so my project is fine, but my question is why is my JRE still running on 11? I've already checked, where java, javac -version, and java -version all say that 14 is my main jdk.

  • The app image is the exploded view of the release structure. You don't really need to use `app-image` except for debugging (as saves time by not needing to re-run the installer every change), or if you need to adjust the release image contents (eg renaming files) before generating the installer of type exe/msi etc. – DuncG Aug 06 '22 at 13:31
  • Check your app-image runtime is correct by running `yourimagedir\YourAppName\runtime\bin\java -version`, and you can get more debug info on the VM settings of each executable if you re-generate with `jpackage --java-options "-XshowSettings:all" ` – DuncG Aug 06 '22 at 13:41
  • @duncG https://imgur.com/a/ErCQnSU This is what I got running Xshowsettings. I'm not sure how to do the first thing you suggested, checking java- version, but it's clearly using an adoptium JDK i installed earlier this week. How do I redirect it? Java.home, java.class.version, java.runtime.version are all wrong, etc. Sorry. Also, is the "application" exe generated by --app-image suitable for deployment on its own, or do I need to package that further? – EveningSt3r Aug 07 '22 at 07:37
  • You can generate a Windows installer in one stage with `jpackage --type MSI|EXE...` or two stages with `jpackage --type app-image --dest blah ...` THEN `jpackage --app-image blah/appname --type MSI|EXE...` – DuncG Aug 08 '22 at 12:25
  • Makes sense. How would I go about fixing the runtime issues? @DuncG – EveningSt3r Aug 08 '22 at 20:49
  • Have you tried JDK17 onwards? It appears to be using older Java perhaps is an environment issue. Normally the EXE is hardwired to use the local runtime/bin version regardless of your current JVM in Path – DuncG Aug 12 '22 at 11:56
  • @DuncG Hi. I got the app-image working by putting the entire 14 JDK into the folder that Jpackage seemed to be randomly using to get its runtime from. It runs on double click and I was able to solve this due to your suggestion to use Xshowsettings. However, upon making that app image into an exe, the download happens but nothing runs. I'm honestly at my wit's end solving this, is it acceptable to ship the app-image folder in one giant zip? This is literally just for my friends to play. If so, what do I need to ship in the zip? – EveningSt3r Aug 14 '22 at 06:36
  • As said above and previous question, try JDK17 onwards rather than incubator / preview `jpackage`. If it is still a problem update this question with much more details of what you have tried. See also https://stackoverflow.com/questions/73076976/java-application-with-jpackage-conflict-with-parallel-installed-jdk-jre – DuncG Aug 14 '22 at 09:46
  • @DuncG Final update: Shipping the app-image was messy but worked. I will try the JDK 17 approach in the near future but for now, I think we can mark one of your comments as an answer. – EveningSt3r Aug 15 '22 at 07:36

0 Answers0