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

Commit 492d332

Browse files
committed
Merge branch 'toonetown-relative_java_home' into develop
2 parents d641639 + 4ffb1ff commit 492d332

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ ChangeLog
1212
* Switch to `/bin/bash` with changes in #35
1313
* Add support for arrays of VMOptions in Apple style Info.plists (PR #25, Thanks to @spectre683 for his contribution)
1414
* Pass command line arguments through to the application (PR #31, Thanks to @dbankieris for his contribution)
15+
* Allow specifying `$JAVA_HOME` relative to `$AppPackageFolder` (PR #26, Thanks to @toonetown for his contribution)
16+
* This allows you to set a relative `$JAVA_HOME` via the `<LSEnvironment>` Plist key
17+
* Which means you can bundle a custom version of Java inside your app!
1518

1619
### v1.0.1 (2015-11-02)
1720
* Improved display error message with applescript (PR #22, Thanks to @ygesnel for his initial contribution)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ The name of the *main class* is also retrieved from `Info.plist`. If no *main cl
6868
There is some *foo* happening to determine which Java versions are installed – here's the list in which order system properties are checked:
6969

7070
1. system variable `$JAVA_HOME`
71+
* can also be set to a relative path using the [`<LSEnvironment>` Plist dictionary key](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/20001431-106825)
72+
* which allows for bundling a custom version of Java inside your app!
7173
2. highest available Java version found in one of these locations:
7274
* `/usr/libexec/java_home` symlinks
7375
* Oracle's JRE Plugin: `/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java`

src/universalJavaApplicationStub

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# #
1414
# @author Tobias Fischer #
1515
# @url https://github.com/tofi86/universalJavaApplicationStub #
16-
# @date 2016-10-11 #
16+
# @date 2016-11-20 #
1717
# @version 1.0.1 #
1818
# #
1919
# #
@@ -371,7 +371,16 @@ oracle_jre_version=`extractJavaMajorVersion "${oracle_jre_plugin}"`
371371

372372
# first check system variable "$JAVA_HOME"
373373
if [ -n "$JAVA_HOME" ] ; then
374-
JAVACMD="$JAVA_HOME/bin/java"
374+
375+
# PR 26: Allow specifying "$JAVA_HOME" relative to "$AppPackageFolder"
376+
# which allows for bundling a custom version of Java inside your app!
377+
if [[ $JAVA_HOME == /* ]] ; then
378+
# if "$JAVA_HOME" starts with a Slash it's an absolute path
379+
JAVACMD="$JAVA_HOME/bin/java"
380+
else
381+
# otherwise it's a relative path to "$AppPackageFolder"
382+
JAVACMD="$AppPackageFolder/$JAVA_HOME/bin/java"
383+
fi
375384

376385
# check for a specific Java version, specified in JVMversion Plist key
377386
elif [ ! -z ${JVMVersion} ] ; then

0 commit comments

Comments
 (0)