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

Commit da2a320

Browse files
committed
update README and console screenshot
1 parent 1d207af commit da2a320

2 files changed

Lines changed: 24 additions & 23 deletions

File tree

README.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,39 @@ A BASH based *JavaApplicationStub* for Java Apps on Mac OS X that works with bot
99
Why
1010
---
1111

12-
Whilst developing some Java apps for Mac OS X I was facing the problem of supporting two different Java versions – the "older" Apple versions and the "newer" Oracle versions.
12+
Whilst developing some Java Apps for Mac OS X I was facing the problem of supporting two different kinds of Java versions – the old Apple versions and the new Oracle versions.
1313

1414
**Is there some difference, you might ask?** Yes, there is!
1515

1616
1. The installation directory differs:
17-
* Apple Java 1.5/1.6: `/System/Library/Java/JavaVirtualMachines/`
17+
* Apple Java 1.5/1.6: `/System/Library/Java/JavaVirtualMachines/` or `/Library/Java/Home/bin/java`
1818
* Oracle JRE 1.7/1.8: `/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/`
1919
* Oracle JDK 1.7/1.8: `/System/Library/Java/JavaVirtualMachines/`
2020

2121
2. Mac Apps built with tools designed for Apple's Java (like Apple's *JarBundler* or the OpenSource [ANT task "Jarbundler"](https://github.com/UltraMixer/JarBundler)) won't work on Macs with Oracle Java 7 and no Apple Java installed.
22-
* This is because Apple's `JavaApplicationStub` only works for Apple's Java and their style to store Java properties in the `Info.plist` file.
23-
* To support Oracle Java 7 you would need to built a separate App package with [Oracles ANT task "Appbundler"](https://java.net/projects/appbundler).
24-
* Thus you would need the user to know which Java distribution he has installed on his Mac. Not very user friendly...
22+
* This is because Apple's `JavaApplicationStub` only works for Apple's Java and their *style* to store Java properties in the `Info.plist` file.
23+
* To support Oracle Java 7 you would need to built a separate App package with [Oracle's ANT task "Appbundler"](https://java.net/projects/appbundler).
24+
* Thus you would need the user to know which Java distribution he has installed on their Mac. Not very user friendly...
2525

26-
3. Oracle uses a different syntax to store Java properties in the applications `Info.plist` file. A Java app packaged as a Mac app with Oracles Appbundler also needs a different `JavaApplicationStub` and therefore won't work on systems with Apple's Java...
26+
3. Oracle uses a different syntax to store Java properties in the applications `Info.plist` file. A Java Application packaged as a Mac App with Oracle's Appbundler also needs a different `JavaApplicationStub` and therefore won't work on systems with Apple's old Java...
2727

2828
4. Starting with Mac OS X 10.10 *(Yosemite)*, Java Apps won't open anymore if they contain the *deprecated* Plist dictionary `Java`. This isn't confirmed by Apple, but [issue #9](https://github.com/tofi86/universalJavaApplicationStub/issues/9) leads to this assumption:
29-
* Apple seems to declare the `Java` dictionary as *deprecated* and ties it to the old Apple Java 6. If you have a newer version installed the app won't open.
29+
* Apple seems to declare the `Java` dictionary as *deprecated* and ties it to their old Apple Java 6. If you have a newer Oracle Java version installed the app won't open.
3030
* If Java 7/8 is installed, Apple doesn't accept those java versions as suitable
3131
* Apple prompts for JRE 6 download even before the `JavaApplicationStub` is executed. This is why we can't intercept at this level and need to replace the `Java` dictionary by a `JavaX` dictionary key.
3232
* This requires to use the latest [JarBundler](https://github.com/UltraMixer/JarBundler/) version (see below for more details)
3333

34-
*So why, oh why, couldn't Oracle just use the old style of storing Java properties in `Info.plist` and offer a universal JavaApplicationStub?!* :rage:
34+
TL;DR: Since there is no universally working JavaApplicationStub for Java 6, 7 and above, and because Apple and Oracle really screwed things up during their Java transition phase, I was in need of a new Stub file.
35+
And well, since I can't write such a script in C, C# or whatever fancy language, I wrote it as a Bash script. And it works!
36+
The original script was inspired by [Ian Roberts stackoverflow answer](http://stackoverflow.com/a/17546508/1128689). Thanks, Ian!
3537

36-
Well, since I can't write such a script in C, C# or whatever fancy language, I wrote it as a Shell script. And it works!
3738

3839
How the script works
3940
--------------------
4041

41-
You don't need a native `JavaApplicationStub` file anymore. The Shell script needs to be executable – that's all.
42+
You don't need a native `JavaApplicationStub` file anymore. The Bash script needs to be executable – that's all.
4243

43-
The script reads JVM properties from `Info.plist` regardless of whether it's Apple or Oracle style and feeds them to a commandline `java` call like the following:
44+
The script reads JVM properties from `Info.plist` regardless of whether it's Apple or Oracle syntax and feeds them to a commandline `java` call like the following:
4445

4546
```Bash
4647
# execute Java and set
@@ -65,9 +66,9 @@ exec "${JAVACMD}" \
6566
${ArgsPassthru:+ $ArgsPassthru}
6667
```
6768

68-
It sets the classpath, the dock icon, the *AboutMenuName* (in Xdock style) and then every *JVMOptions*, *JVMDefaultOptions* or *JVMArguments* found in the `Info.plist` file.
69+
It sets the classpath, the dock icon, the *AboutMenuName* (as Xdock parameter) and then every *JVMOptions*, *JVMDefaultOptions* or *JVMArguments* found in the `Info.plist` file. See the table below for more supported Plist keys.
6970

70-
The WorkingDirectory is either retrieved from Apple's Plist key `Java/WorkingDirectory` or set to the JavaRoot directory within the app bundle.
71+
The *WorkingDirectory* is either retrieved from Apple's Plist key `Java/WorkingDirectory` or set to the JavaRoot directory within the app bundle.
7172

7273
The name of the *main class* is also retrieved from `Info.plist`. If no *main class* is found, an AppleScript error dialog is shown and the script exits with *exit code 1*.
7374

@@ -80,14 +81,16 @@ There is some *foo* happening to determine which Java versions are installed –
8081
* `/usr/libexec/java_home` symlinks
8182
* Oracle's JRE Plugin: `/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java`
8283
* Symlink for old Apple Java: `/Library/Java/Home/bin/java`
83-
3. If you require a specific Java version with the Plist key `JVMVersion` the script will try to find a matching JDK or JRE in all of the above locations
84+
3. If you require a specific to-the-point Java version or a **minimum requirement** with the Plist key `JVMVersion` the script will try to find a matching JDK or JRE in all of the above locations
8485
* if multiple matching JVM's are found, the script will pick the latest (highest version number)
86+
* starting from version 3.0 of this script you can use a special syntax in Plist key `JVMVersion` to specify a **max requirement**. See [issue #51](https://github.com/tofi86/universalJavaApplicationStub/issues/51) for examples.
8587

86-
If none of these could be found or executed the script shows an AppleScript error dialog saying that Java needs to be installed:
88+
If none of these can be found or executed the script shows an AppleScript error dialog saying that Java needs to be installed:
8789

8890
![Error Dialog No Java Found](/docs/java-error.png?raw=true)
8991

90-
Messages are localized and displayed either in English (Default), French or German. Language contributions are very welcome!
92+
Messages are **localized** and displayed either in English (Default), French, German or Chinese. Language contributions are very welcome! Thank you!
93+
9194

9295
What you need to do
9396
-------------------
@@ -119,7 +122,7 @@ Then place the `universalJavaApplicationStub` from this repo in your build resou
119122
</jarbundler>
120123
```
121124

122-
The ANT task will care about the rest...
125+
The ANT task will take care of all the rest... But of course you can specify more options. Please check the JarBundler docs.
123126

124127
You should get a fully functional Mac Application Bundle working with both Java distributions from Apple and Oracle and all Mac OS X versions.
125128

@@ -136,21 +139,19 @@ Just place the `universalJavaApplicationStub` from this repo in your build resou
136139
</appbundler>
137140
```
138141

139-
140-
The ANT task will care about the rest...
142+
The ANT task will take care of all the rest... But of course you can specify more options. Please check the Appbundler docs.
141143

142144
You should get a fully functional Mac Application Bundle working with both Java distributions from Apple and Oracle and all Mac OS X versions.
143145

144146

145-
146147
Supported PList keys
147148
--------------------
148149

149150
| Function | Apple PList key | Oracle PList key |
150151
|---------------------------------|------------------------|-----------------------|
151152
| **App Name** (Dock Name) | `:CFBundleName` | `:CFBundleName` |
152153
| **App Icon** (Dock Icon) | `:CFBundleIconFile` | `:CFBundleIconFile` |
153-
| **Working Directory** | `:Java(X):WorkingDirectory`<br/>fallback to `name.app/` | *not supported*<br/>default: `name.app/Contents/Java/` |
154+
| **Working Directory** | `:Java(X):WorkingDirectory`<br/>fallback to `name.app/`<br/>support for variables `$APP_PACKAGE`, `$JAVAROOT`, `$USER_HOME` | *not supported*<br/>default: `name.app/Contents/Java/` |
154155
| **Java Min/Max[*](https://github.com/tofi86/universalJavaApplicationStub/issues/51) Version Requirement** | `:Java(X):JVMVersion` | *not supported* |
155156
| **Java ClassPath** (`-cp …`) | `:Java(X):ClassPath` | `:JVMClassPath` |
156157
| **Java Main Class** | `:Java(X):MainClass` | `:JVMMainClassName` |
@@ -161,14 +162,14 @@ Supported PList keys
161162
| **Main Class Arguments** | `:Java(X):Arguments` | `:JVMArguments` |
162163

163164

164-
165165
Logging
166166
-------
167167

168-
Starting with version 2.2.0 `universalJavaApplicationStub` logs data to the `syslog` which can be easily accessed with the `Console.app` utility by searching for *syslog*:
168+
Starting with version 3.0 `universalJavaApplicationStub` logs data to the `syslog` facility which can be easily accessed with the `Console.app` utility by searching for *syslog*:
169169

170170
![Example log data in Console.app](/docs/ConsoleAppLogging.png?raw=true)
171171

172+
Log data includes debug information of the JVM search strategy, App name, language, selected JVM, WorkingDirectory and exec call.
172173

173174

174175
Missing Features

docs/ConsoleAppLogging.png

108 KB
Loading

0 commit comments

Comments
 (0)