|
| 1 | +[](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.scijava%22%20AND%20a%3A%22app-launcher%22) |
| 2 | +[](https://github.com/scijava/app-launcher/actions/workflows/build.yml) |
| 3 | + |
| 4 | +The SciJava app launcher provides an entry point into SciJava applications, |
| 5 | +notably [Fiji](https://fiji.sc/). |
| 6 | + |
| 7 | +Its most major functions are: |
| 8 | + |
| 9 | +* Ensure the version of Java being used is appropriate to app's requirements. |
| 10 | + In case it isn't, offer to upgrade Java by downloading a more appropriate version. |
| 11 | + |
| 12 | +* Load classes dynamically, without relying on the system classpath. |
| 13 | + |
| 14 | +* Display a splash window while the application is starting up. |
| 15 | + |
| 16 | +## Supported configuration |
| 17 | + |
| 18 | +The app-launcher uses system properties to configure its behavior: |
| 19 | + |
| 20 | +* `scijava.app.name`: Name of the application being launched. |
| 21 | + Used in message dialogs if/when interacting with the user. |
| 22 | + |
| 23 | +* `scijava.app.splash-image`: Resource path to an image for the splash window, |
| 24 | + to be loaded using `ClassLoader#getResource`. It can be either its own file |
| 25 | + or stored within a JAR file, as long as the resource is on the classpath. |
| 26 | + |
| 27 | +* `scijava.app.look-and-feel`: Fully qualified class name of a Swing |
| 28 | + `LookAndFeel` to be set before any UI components are created or shown. |
| 29 | + This can be useful to ensure a consistent appearance between the app-launcher |
| 30 | + splash and dialog UI with any later application UI, as well as to improve UI |
| 31 | + behavior on HiDPI displays using smarter Look & Feels such as |
| 32 | + [FlatLaf](https://www.formdev.com/flatlaf/). |
| 33 | + |
| 34 | +* `scijava.app.java-root`: directory containing "bundled" installations of Java. |
| 35 | + The `Java.root()` method reports this value if it points to a valid directory. |
| 36 | + The `Java.check()` method will look here (via `Java.root()`) for which JVMs |
| 37 | + are already present locally, and also unpack any newly downloaded JVM into |
| 38 | + this directory. |
| 39 | + |
| 40 | +* `scijava.app.java-links`: URL of a plain text file containing links to |
| 41 | + desirable Java bundles. The format is `<platform>=<url>` for each platform |
| 42 | + (OS+architecture) of Java that you want to support. For example: |
| 43 | + ``` |
| 44 | + linux-arm64=https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_aarch64.tar.gz |
| 45 | + linux-x64=https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_x64.tar.gz |
| 46 | + macos-arm64=https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_aarch64.tar.gz |
| 47 | + macos-x64=https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_x64.tar.gz |
| 48 | + windows-arm64=https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-win_aarch64.zip |
| 49 | + windows-x64=https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-win_x64.zip |
| 50 | + ``` |
| 51 | + The exact naming is up to you, but for a Java distribution to be downloaded, |
| 52 | + the `scijava.app.platform` property must be set and match one of the keys |
| 53 | + indicated within the fetched remote resource. |
| 54 | + |
| 55 | +* `scijava.app.java-version-minimum`: The minimum version of Java required by |
| 56 | + the application. It can be a standalone number like 11, in which case it is |
| 57 | + treated as a major version, or a dot-separated sequence of digits, which case |
| 58 | + version comparisons are done digit by digit (see `Versions.compare`). |
| 59 | + This value is used by `Java.check()` (via `Java.minimumVersion()`) to |
| 60 | + warn the user accordingly if the running Java version is not good enough. |
| 61 | + |
| 62 | +* `scijava.app.java-version-recommended`: The minimum version of Java the |
| 63 | + application would *prefer* to use. Same syntax as `java-version-minimum`. |
| 64 | + This value is used by `Java.check()` (via `Java.recommendedVersion()`) to |
| 65 | + warn the user accordingly if the running Java version is not ideal. |
| 66 | + |
| 67 | +## Provenance |
| 68 | + |
| 69 | +The SciJava app-launcher evolved from the |
| 70 | +[ImageJ Launcher](https://github.com/imagej/imagej-launcher), |
| 71 | +which was a prior solution for launching [Fiji](https://fiji.sc/). |
| 72 | + |
| 73 | +The imagej-launcher's `ClassLauncher` supported a couple of |
| 74 | +Fiji/ImageJ-specific flags that this SciJava app-launcher does not: |
| 75 | + |
| 76 | +**`-ijjarpath <path>`:** This flag provided automatic loading of plugins in |
| 77 | +`$HOME/.plugins` as well as from the value(s) of the `ij1.plugin.dirs` system |
| 78 | +property, when `<path>` was set to `plugins`. To accomplish an equivalent thing |
| 79 | +with the app-launcher, use something like: |
| 80 | +```shell |
| 81 | +-jarpath plugins:"$HOME"/.plugins:/path1:/path2:/path3 |
| 82 | +``` |
| 83 | +rather than: |
| 84 | +```shell |
| 85 | +-Dij1.plugin.dirs=/path1:/path2:/path3 -jarpath plugins |
| 86 | +``` |
| 87 | + |
| 88 | +This works because the `org.scijava.launcher.ClassLauncher`'s `-jarpath` |
| 89 | +handling splits on colons/semicolons. |
| 90 | + |
| 91 | +**`-ijcp <path1:path2:...>`:** This was an undocumented feature, not used by |
| 92 | +normal Fiji/ImageJ launches. You can accomplish something similar using |
| 93 | +`-cp <path1:path2:...>` instead. |
0 commit comments