Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. jpackage Failed to Launch JVM with 3rd party jars without jmods

jpackage Failed to Launch JVM with 3rd party jars without jmods

Scheduled Pinned Locked Moved Java
2 Posts 1 Posters 104 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Valentinor
    wrote last edited by
    #1

    Hi!

    I am trying to make an exe for my Java project, and for that I tried to use the following cmd:

    jpackage -t app-image --name "App Name" --vendor "Vendor" --app-version 1.0 --input "E:\Jar" --dest "E:\Release" --main-jar "My App.jar" --icon "E:\Icon.ico" --module-path "C:\Program Files\Eclipse Adoptium\jdk-21.0.8.9-hotspot\jmods;E:\ProgramUse\Java\JavaFX\javafx-jmods" --add-modules java.base,java.datatransfer,java.desktop,java.sql,javafx.base,javafx.controls,javafx.graphics
    

    But when the exe is made I get "Failed to Launch JVM".

    If I use that cmd on a different project it is working fine. BUT the main difference is that the other project doesn't have 3rd party jars other then JavaFX for which I have the jmods.

    For the project with the problem I am using other jars as well, and when I am running:

    jdeps --multi-release 21 --list-deps --ignore-missing-deps --module-path "E:\ProgramUse\Java\JavaFX\sdk\lib;E:\ProgramUse\Java\Jars\ProjectRequired" "E:\Jar\My app.jar"
    

    I get this:

    jakarta.mail
    java.base
    java.datatransfer
    java.desktop
    java.sql
    javafx.base
    javafx.controls
    javafx.graphics
    org.bouncycastle.lts.prov
    

    And from that I guess the problem is jakarta.mail and org.bouncycastle.lts.prov.

    How do I handle this scenario? I do not have the jmods for both of them. All the jars are included in the runnable jar made by Eclipse.

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Valentinor
      wrote last edited by
      #2

      So it turns out that I was getting that error because of connection to DB which was in void main for testing, but now I moved it on a button press:

      con = DriverManager.getConnection(db, userDB, passDB);
      

      The thing is, in Eclipse it is working fine, but in packed form, when I call that it just hangs, it doesn't advance. I did a little test around it and the status stays at "Starting connecting".

      statusDB.setText("Starting connecting");
      			Thread thread = new Thread(new Runnable() {
      				public void run() {
      					try {
      						con = DriverManager.getConnection(db, userDB, passDB);
      						Platform.runLater(new Runnable() {
      							@Override
      							public void run() {
      								statusDB.setText("Connected");
      							}
      						});
      					} catch (Exception e) {
      						e.printStackTrace();
      						FunctionsCode.writeError(e);
      						con = null;
      						Platform.runLater(new Runnable() {
      							@Override
      							public void run() {
      								statusDB.setText("Failed");
      							}
      						});
      					}
      				}
      			});
      			thread.start();
      

      I am using PostgreSQL. Why does it hang in packed form?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups