1. shemnon
  2. javafx-gradle
Issue #35 new

Ability to specify and link in a preloader from a jar

William Daniels
created an issue

I was looking through the source code for some type of ability to link in a preloader in the 'javafx fashion' (loading the jar before the actual application even loads), and I couldn't find any way to go about it. While I do believe it's certainly possible to 'hack' around it by simply instantiating the preloader in a specific fashion in the start() method of my application, this is certainly not preferable.

I noticed on line 77, you have the line:

       //createJarParams.preloader

which is obviously not in use, it'd be really great if this functionality could be expanded upon.

-Will

Comments (3)

  1. Ed Hillmann

    I've tried to have a try at this, but it's not going far...

    https://bitbucket.org/edhillmann/javafx-gradle/branches/compare/edhillmann/javafx-gradle:iss35..shemnon/javafx-gradle:master#diff

    It looks like I need to include this in the jfxDeploy task (but the comments indicate that it could be added in the jfxJar task?).

    My @TaskAction isn't working though. I don't know how to define the parameter for the preloaded. There's something that has a .ID attribute, that I cannot find the definition.

    Is this the correct track? Any hints on how I can get this closer to functioning? The above diff has some changes, but nothing complete.

  2. Michael Schulz

    You can put the required entries to the MANIFEST.MF in the jar task.

    
    

    jar { manifest { attributes('-x-bogus': 'a bogus attribute', '-x-bogus-2': 'a second bogus attribute', 'JavaFX-Preloader-Class': 'your.Preloader', 'JavaFX-Class-Path': "your-preloader-${version}.jar", 'JavaFX-Application-Class': 'yout.MainApplication', 'JavaFX-Fallback-Class': 'com.javafx.main.NoJavaFXFallback' ) } }

    
    

    and in the javafx task put the following entry to the attribute mainClass

    
    

    javafx {

    mainClass 'com.javafx.main.Main'

    }

    
    

    further infos: http://docs.oracle.com/javafx/2/deployment/preloaders.htm

  3. Log in to comment