Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8101773

Add option to packer to add launcher class to existing jar

    XMLWordPrintable

    Details

      Backports

        Description

        The current javafxpackager.exe will let me create a .jar out of .class files. But my build process is different enough to make the packager useless. I use the Leiningen build tool (which uses Maven repositories, and basically can be thought of as a nice syntax layer over Maven), which will create an überjar for me, which contains my application and all its dependencies.
        Well, not all dependencies... JavaFX is not included, as Oracle doesn't offer it as a Dependency in the Central repo.
        But this issue is not about that — I can safely assume for now that my users already have JFX installed on their machines.
        The problem is that my application can not be started with a double click, because the JVM does not know how to find the installed JFX runtime.
        The Ensemble app however can be double-clicked and runs fine. This is because it contains the files in com.javafx.main.* and because it has
        a modified manifest file.

        I would like the packager have to get a new command line option, which will take an existing .jar file and add those four launcher classes to it,
        and update the manifest file.
        javafxpackage -updatejar -appclass my.main.module -jarfile my_existing.jar

        Optionally this can take an argument -outfile my_new.jar which will copy my_existing.jar first and then modify the copy, instead of modifying the file specified via "-jarfile".
        After this operation my_existing.jar would include the files
        com/javafx/main/Main.class
        com/javafx/main/Main$1.class
        com/javafx/main/Main$2.class
        com/javafx/main/NoJavaFXFallback.class

        and the MANIFEST.MF which looked before like:
        Manifest-Version: 1.0
        Built-By: John Smith
        Created-By: Leiningen 2.0.0
        Main-Class: my.main.module

        will now be:
        Manifest-Version: 1.0
        Built-By: John Smith
        JavaFX-Application-Class: my.main.module <=== this was in Main-Class in the input manifest file
        Created-By: Leiningen 2.0.0-SNAPSHOT
        Main-Class: com.javafx.main.Main <=== the new Main

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                igor Igor Nekrestyanov (Inactive)
                Reporter:
                athiemejfx Andre Thieme (Inactive)
                Votes:
                1 Vote for this issue
                Watchers:
                7 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported: