Skip to content

Splash Screen of Java not loading from FatCapsule Task jar #31

@faizanahemad

Description

@faizanahemad

Capsule Plugin Version

1.0.2

Gradle Version

2.13

Expected Behavior

Splash screen configured in Manifest of jar task should display when running the fatjar

Actual Behavior

Splash screen does not load.
Calling SplashScreen.getSplashScreen(); returns Null

Gradle Build Script(s)

build.gradle
gradle.properties
setting.gradle
SplashDemo.java
If you clone the repo you can use ./gradlew clean build fatCapsule shadowJar for building, then go to build/libs execute java -jar splash-screen-0.0.1-shadow.jar to see Shadow Jar running. You can see the Capsule plugin jar output by ./splash-screen-0.0.1-release.jar. The shadow plugin jar does show the Splash screen.

Content of Capsule JAR (jar tf <jar file> - post link to GIST if too long)

META-INF/
META-INF/MANIFEST.MF
Capsule.class
splash-screen-0.0.1-all.jar

More Details

Another Plugin-Gradle ShadowJar Plugin does work correctly for this.

For debugging I added

ClassLoader CLDR = sd.getClass().getClassLoader();
InputStream is = CLDR.getResourceAsStream("loader.gif");
System.out.println("Stream File Size: "+is.available());

And my jar manifest attribute in build.gradle contains 'SplashScreen-Image': 'loader.gif'
Output I got: Stream File Size: 24055 which means the classLoader is able to find the loader.gif.

Jar and FatCapsule in build.gradle

jar {
    classifier = 'all'
    manifest {
        attributes 'Implementation-Title': title,
                'Implementation-Version': version,
                'Main-Class': mainClassFile,
                'SplashScreen-Image': 'loader.gif'
    }
    include{sourceSets.main.output.classesDir}
    zip64 true

}

task fatCapsule(type: FatCapsule) {
    applicationClass mainClassFile
    classifier = 'release'
    reallyExecutable
    capsuleManifest {
        systemProperties['logs'] = './logs'
        minJavaVersion = '1.8.0'
        args = ['-splash:loader.gif']
    }
}

Removing args = ['-splash:loader.gif'] from fatCapsule has no effect. Also I have tried multiple paths like /loader.gif or resources/loader.gif or /resources/loader.gif. Nothing seems to be working while the shadow plugin works with just 'SplashScreen-Image': 'loader.gif'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions