Skip to content

Commit b994ac0

Browse files
committed
Add initial app-launcher implementation
Some of this code came from the old ImageJ Launcher, and more was written by me from 2024-10-10 through 2024-10-20.
0 parents  commit b994ac0

26 files changed

+2342
-0
lines changed

.github/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-build.sh
3+
sh ci-build.sh

.github/setup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-setup-github-actions.sh
3+
sh ci-setup-github-actions.sh

.github/workflows/build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "*-[0-9]+.*"
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Java
20+
uses: actions/setup-java@v2
21+
with:
22+
java-version: '8'
23+
distribution: 'zulu'
24+
cache: 'maven'
25+
- name: Set up CI environment
26+
run: .github/setup.sh
27+
- name: Execute the build
28+
run: .github/build.sh
29+
env:
30+
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
31+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
32+
MAVEN_USER: ${{ secrets.MAVEN_USER }}
33+
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
34+
OSSRH_PASS: ${{ secrets.OSSRH_PASS }}
35+
SIGNING_ASC: ${{ secrets.SIGNING_ASC }}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Maven #
2+
/target/
3+
# IntelliJ #
4+
/.idea/
5+
# Eclipse #
6+
/.classpath
7+
/.project
8+
/.settings/

LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2007 - 2024, SciJava developers.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24+
POSSIBILITY OF SUCH DAMAGE.

NOTICE.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Parts of this code are derived from the ImageJ Launcher (which
2+
(itself was derived from its prior incarnation, the Fiji Launcher):
3+
4+
https://github.com/imagej/imagej-launcher
5+
6+
Copyright (c) 2007 - 2022, ImageJ2 developers.
7+
All rights reserved.
8+
9+
Redistribution and use in source and binary forms, with or without modification,
10+
are permitted provided that the following conditions are met:
11+
12+
1. Redistributions of source code must retain the above copyright notice, this
13+
list of conditions and the following disclaimer.
14+
15+
2. Redistributions in binary form must reproduce the above copyright notice,
16+
this list of conditions and the following disclaimer in the documentation
17+
and/or other materials provided with the distribution.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+
POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
[![](https://img.shields.io/maven-central/v/org.scijava/app-launcher.svg)](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/badge.svg)](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.

pom.xml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>org.scijava</groupId>
7+
<artifactId>pom-scijava</artifactId>
8+
<version>39.0.0</version>
9+
<relativePath />
10+
</parent>
11+
12+
<artifactId>app-launcher</artifactId>
13+
<version>1.0.0-SNAPSHOT</version>
14+
15+
<name>SciJava App Launcher</name>
16+
<description>Launcher for SciJava applications.</description>
17+
<url>https://github.com/scijava/app-launcher</url>
18+
<inceptionYear>2007</inceptionYear>
19+
<organization>
20+
<name>SciJava</name>
21+
<url>https://scijava.org/</url>
22+
</organization>
23+
<licenses>
24+
<license>
25+
<name>Simplified BSD License</name>
26+
<distribution>repo</distribution>
27+
</license>
28+
</licenses>
29+
30+
<developers>
31+
<developer>
32+
<id>ctrueden</id>
33+
<name>Curtis Rueden</name>
34+
<url>https://github.com/ctrueden</url>
35+
<roles>
36+
<role>founder</role>
37+
<role>lead</role>
38+
<role>developer</role>
39+
<role>debugger</role>
40+
<role>reviewer</role>
41+
<role>support</role>
42+
<role>maintainer</role>
43+
</roles>
44+
</developer>
45+
</developers>
46+
<contributors>
47+
<contributor>
48+
<name>Johannes Schindelin</name>
49+
<url>https://github.com/dscho</url>
50+
<properties><id>dscho</id></properties>
51+
</contributor>
52+
<contributor>
53+
<name>Stefan Helfrich</name>
54+
<url>https://github.com/stelfrich</url>
55+
<properties><id>stelfrich</id></properties>
56+
</contributor>
57+
</contributors>
58+
59+
<mailingLists>
60+
<mailingList>
61+
<name>Image.sc Forum</name>
62+
<archive>https://forum.image.sc/tag/scijava</archive>
63+
</mailingList>
64+
</mailingLists>
65+
66+
<scm>
67+
<connection>scm:git:https://github.com/scijava/app-launcher</connection>
68+
<developerConnection>scm:git:[email protected]:scijava/app-launcher</developerConnection>
69+
<tag>HEAD</tag>
70+
<url>https://github.com/scijava/app-launcher</url>
71+
</scm>
72+
<issueManagement>
73+
<system>GitHub Issues</system>
74+
<url>https://github.com/scijava/app-launcher/issues</url>
75+
</issueManagement>
76+
<ciManagement>
77+
<system>GitHub Actions</system>
78+
<url>https://github.com/scijava/app-launcher/actions</url>
79+
</ciManagement>
80+
81+
<properties>
82+
<package-name>org.scijava.launcher</package-name>
83+
<main-class>org.scijava.launcher.ClassLauncher</main-class>
84+
85+
<license.licenseName>bsd_2</license.licenseName>
86+
<license.copyrightOwners>SciJava developers.</license.copyrightOwners>
87+
<license.projectName>Launcher for SciJava applications.</license.projectName>
88+
</properties>
89+
90+
<dependencies>
91+
<dependency>
92+
<groupId>org.junit.jupiter</groupId>
93+
<artifactId>junit-jupiter-api</artifactId>
94+
<scope>test</scope>
95+
</dependency>
96+
<dependency>
97+
<groupId>com.formdev</groupId>
98+
<artifactId>flatlaf</artifactId>
99+
<scope>test</scope>
100+
<optional>true</optional>
101+
</dependency>
102+
</dependencies>
103+
</project>

0 commit comments

Comments
 (0)