Thanks to visit codestin.com
Credit goes to github.com

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

JVMVersion in plist is ignored #13

Closed
Dylan-M opened this issue Feb 19, 2015 · 5 comments
Closed

JVMVersion in plist is ignored #13

Dylan-M opened this issue Feb 19, 2015 · 5 comments
Assignees

Comments

@Dylan-M
Copy link

Dylan-M commented Feb 19, 2015

Currently the JVMVersion tag [present in Apple info.plist, not sure about Oracle style] is being ignored.
I added the following in one of the general definition sections at the top of the file:

# set the default JVM Version to a null string
JVMVersion=""

I've added the following code to the apple plist section:

    # read the Java version we want to find
    JVMVersion=`/usr/libexec/PlistBuddy -c "print :Java:JVMVersion" "${InfoPlistFile}" 2> /dev/null | xargs`
    if [ "${JVMVersion}" != "" ]; then
        JVMVersion="-v "${JVMVersion}
    fi

And finally I modified the following in the find java section

# otherwise check "/usr/libexec/java_home" symlinks
elif [ -x /usr/libexec/java_home ] && [ -d "`/usr/libexec/java_home ${JVMVersion} 2> /dev/null`" ] ; then
    JAVACMD="`/usr/libexec/java_home ${JVMVersion} 2> /dev/null`/bin/java"

And everything works kosher for me! If I exclude this, java_home still points to Apple's JDK6, but if I include it then it correctly points to my installed JDK8

@tofi86
Copy link
Owner

tofi86 commented Feb 19, 2015

Yes, this is currently unsupported as stated in Missing Features.

But thanks for trying and and the code contribution.
Will see whether I'll find the time to test & merge in the next couple of weeks...

@Dylan-M
Copy link
Author

Dylan-M commented Feb 19, 2015

Aye, it's working great for me and the few people who've beta tested it for me. This combined with the other report I made are both working without complaint from my play testers so far.

EDIT: Also, thank you very much for this script, you solved a 2 year search for a way to universally fix our Mac app packaging!

You can find the current debug version here.

@Dylan-M
Copy link
Author

Dylan-M commented Feb 19, 2015

Just as an update, the project I'm on has pushed my updated version of the script into our SVN with a lot of positive feedback from Mac users. You can see my updated script here:
https://sourceforge.net/p/megamek/code/HEAD/tree/trunk/megamek/packaging_utils/JavaApplicationStub

@tofi86
Copy link
Owner

tofi86 commented Feb 22, 2015

Thanks for your suggestions and contributions, @Dylan-M

Next version will contain support for JVMVersion key. If a JVMVersion key is specified, the launcher tries to find this version without any fallback. If no suitable Java version can be found on the system, an error dialog is displayed:
bildschirmfoto 2015-02-22 um 17 54 35
The launcher script will not use a possible JVM fallback provided by /usr/libexec/java_home when finding no suitable version.

@Dylan-M
Copy link
Author

Dylan-M commented Feb 22, 2015

If possible, you should probably add a comment that the plist entry is best with the + so that it will allow newer versions to support updates ;)

@tofi86 tofi86 self-assigned this Feb 22, 2015
@tofi86 tofi86 closed this as completed in 99f2d7f Feb 22, 2015
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