Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Feature request to suppress -splash option if no splash image is provided #94

Closed
1 of 3 tasks
treimers opened this issue Dec 31, 2020 · 4 comments
Closed
1 of 3 tasks
Assignees
Milestone

Comments

@treimers
Copy link

I'm submitting a…

  • bug report
  • feature request
  • other

Short description of the issue/suggestion:
I am using universalJavaApplicationStub to build and run my application under Mac OS X. This works great, thank you for an awesome software.

I have been running into an issue that seems to be a Java FX bug. It looks like using the Mac OS X system menu in Java FX togehter with -splash option on start of Java VM does not work. You can find a longer description of my problem here.

Steps to reproduce the issue/enhancement:
Create a simple Java FX application with menu bar, set useSystemMenuBar to true and start the application using universalJavaApplicationStub. The SystemMenuBar is not used and supported (as of -splash option used by universalJavaApplicationStub script).

You can find my example code and detailed explanations here.

What is the expected behavior?

When no splash image is provided it would be nice if the -splash option could be suppressed.

What is the current behavior?

The -splash option is always used.

Do you have screenshots, GIFs, demos or samples which demonstrate the problem or enhancement?

See the stackoverflow description and screenshots.

What is the motivation / use case for changing the behavior?

It would be nice to have a workaround for the Java FX bug in case when no splash screen is used.

Please tell us about your environment:

  • universalJavaApplicationStub version: 3.0.6
  • Mac OS version: OS X El Capitan (10.11.6)
  • Java version(s): openjdk version "15" 2020-09-15
    OpenJDK Runtime Environment AdoptOpenJDK (build 15+36)
    OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15+36, mixed mode, sharing)

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

Suppressing the splash option might be done somehow like this:

# create splash option if splash image is available
if [[ -n $JVMSplashFile ]]
then
        splashOption="-splash:\"${ResourcesFolder}/${JVMSplashFile}\""
else
        splashOption=
fi

and

exec "${JAVACMD}" \
                -cp "${JVMClassPath}" \
                ${splashOption} \
                -Xdock:icon="${ResourcesFolder}/${CFBundleIconFile}" \
                -Xdock:name="${CFBundleName}" \
                ${JVMOptionsArr:+"${JVMOptionsArr[@]}" }\
                ${JVMDefaultOptions:+$JVMDefaultOptions }\
                "${JVMMainClass}"\
                ${MainArgsArr:+ "${MainArgsArr[@]}"}\
                ${ArgsPassthru:+ "${ArgsPassthru[@]}"}

I know the handling of quotes must be reviewed and corrected in order to handle spaces in splash image file name. But to be honest I am not an expert.

And finally, this is my Info.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <dict>
                <key>CFBundleGetInfoString</key>
                <string>JPrefs 0.2</string>
                <key>CFBundleDevelopmentRegion</key>
                <string>English</string>
                <key>CFBundleExecutable</key>
                <string>universalJavaApplicationStub</string>
                <key>CFBundleIconFile</key>
                <string>JPrefs.icns</string>
                <key>CFBundleIdentifier</key>
                <string>de.softquadrat.jprefs.JPrefs</string>
                <key>CFBundleDisplayName</key>
                <string>JPrefs</string>
                <key>CFBundleInfoDictionaryVersion</key>
                <string>6.0</string>
                <key>CFBundleName</key>
                <string>JPrefs</string>
                <key>CFBundlePackageType</key>
                <string>BNDL</string>
                <key>CFBundleShortVersionString</key>
                <string>0.2</string>
                <key>CFBundleSignature</key>
                <string>????</string>
                <key>CFBundleVersion</key>
                <string>0.2</string>
                <key>NSHumanReadableCopyright</key>
                <string>SoftQuadrat GmbH</string>
                <key>NSHighResolutionCapable</key>
                <true />
                <key>NSSupportsAutomaticGraphicsSwitching</key>
                <true />
                <key>AdministratorRequired</key>
                <false />
                <key>JavaX</key>
                <dict>
                        <key>MainClass</key>
                        <string>de.softquadrat.jprefs.JPrefs</string>
                        <key>ClassPath</key>
                        <array>
                                <string>Java/JPrefs-0.2-runnable.jar</string>
                        </array>
                        <key>WorkingDirectory</key>
                        <string>$APP_PACKAGE/Contents/Resources</string>
                </dict>
                <key>LSEnvironment</key>
                <dict>
                        <key>JAVA_HOME</key>
                        <string>Contents/PlugIns/jre/Contents/Home</string>
                </dict>
                <key>NSAppleEventsUsageDescription</key>

                <string>There was an error while launching the application. Please
                        click OK to display a dialog with more information or cancel and view
                        the syslog for details.</string>
        </dict>
</plist>
@tofi86
Copy link
Owner

tofi86 commented Jan 6, 2021

Hi Thorsten,

I have been running into an issue that seems to be a Java FX bug. It looks like using the Mac OS X system menu in Java FX togehter with -splash option on start of Java VM does not work. You can find a longer description of my problem here.

well, that's indeed odd...

And you're right, the splashscreen option shouldn't be passed at any time, regardless of the existence of a splash file...

I'll try to fix this with the next release...

@tofi86 tofi86 self-assigned this Jan 6, 2021
@tofi86 tofi86 added the bug label Jan 6, 2021
@tofi86 tofi86 added this to the Version 3.1.0 milestone Jan 6, 2021
@tofi86
Copy link
Owner

tofi86 commented Jan 6, 2021

Can be done with a plain bash parameter expansion.

Fixed with 15833ec on develop.

@tofi86
Copy link
Owner

tofi86 commented Jan 7, 2021

Version 3.1.0 has officially been released 🎉

Details: https://github.com/tofi86/universalJavaApplicationStub/releases/tag/v3.1.0

@treimers
Copy link
Author

treimers commented Jan 7, 2021

Hi @tofi86,
this is great!
Many thanks,
Thorsten

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants