How to make a runnable jar for an application that uses JavaFX without its own installers

I have an application that works fine to work with java -jar blah.jar after exporting as an executable jar from Eclipse and providing it with a "Package of required libraries in the generated JAR".

I added JavaFX code to open a web browser. Now it seems impossible to make a runnable jar that works on small versions of Java. When I export it as a runnable jar, it copies to jfxrt.jar, which is typical for my younger version. If I started this jar using "java -jar blah.jar" for the exact corresponding java version (jdk1.7.0_17), then it works fine, but if I use it a little newer (jdk1.7.0_45), then it will not be able to allow swingx classes. So much for "write, sometime run anywhere."

I tried using JavaFX ant tasks, but I can't get the task to actually package dependent banks. Actually, this does not include the fx: resources flags in the bank being created, for example, the magic eclipse "required package libraries in the generated JAR" works fine:

<fx:jar destfile="${dist}/${dist.jar}"> 
        <fx:application id="BlahTesterApp" 
            mainClass="blah.MainClass" 
            toolkit="swing"/> 

        <fileset dir="${build}"/> 

        <fx:resources> 
            <fx:fileset dir="${lib}" includes="**/*.jar" />
        </fx:resources>

        <manifest> 
            <attribute name="Implementation-Vendor" value="My Team"/>
            <attribute name="Implementation-Title" value="Tester App"/> 
        </manifest> 
    </fx:jar> 

And, it seems, only you can create "native bundles" that I do not want. I do not want users to install rpm or deb when they only use the ability to run the darn jar.

I don’t understand why Oracle had to introduce its own magical additional level of deployment complexity. Don't they want people to use JavaFX?

+4
source share
1 answer

JavaFX

(1), e (fx) , Eclipse.

Java- (, jfxrt.jar) . , , (- , ). , , JRE ( ).

+5

Source: https://habr.com/ru/post/1536846/


All Articles