Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility with Java 13 #400

Merged
merged 19 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ canvases
.idea
*.iml
*.class
*.java-version
*dockerfile
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: java
jdk: oraclejdk8
dist: trusty
jdk: openjdk13
dist: focal
services:
- xvfb
branches:
only:
- master
Expand Down
130 changes: 51 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,20 @@ Paintera is a general visualization tool for 3D volumetric data and proof-readin

## Installation and Usage

Paintera is available for installation through [conda](#conda) and the [Python Package Index](#pip). Alternatively, you can use [jgo](#jgo) to run Paintera from an existing Maven artifact on the [SciJava Maven repository](https://maven.scijava.org) or your local maven repository, typically located at `$HOME/.m2` on your computer. For all of these options, Java 8 with JavaFX and Apache Maven are requirement. Efforts to create a standalone app have not been successful so far ([#253](https://github.com/saalfeldlab/paintera/issues/253)).
Paintera is available for installation through [conda](#conda) and the [Python Package Index](#pip). If installing via [conda](#conda), dependencies are handled for you. When installing from [pip](#pip) it is necessary to install, Java 11 and Apache Maven. Efforts to create a standalone app have not been successful so far ([#253](https://github.com/saalfeldlab/paintera/issues/253)).

### Dependencies

Java 8 (through [OpenJDK](https://openjdk.java.net/)), JavaFX, and Apache Maven are available for [installation on many Linux distributions](#installation-on-linux).
*Note* This section is not required if installing via [conda](#conda).

On Windows and macOS the use of [Oracle Java 8](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) (comes with JavaFX) is recommended and [Apache Maven needs to be downloaded and installed](https://maven.apache.org) manually. Make sure that both Java and Maven are available on the `PATH` after installation. Note that our experience with Windows and macOS installations is very limited and there may be better ways to install Java 8 with JavaFX and Maven on these operating systems. If you are aware of any, please create a pull request to add these to this README.

Alternatively, OpenJDK and Maven are available through the default (`pkgs/main`) and `conda-forge` channels on [conda](https://conda.io), respectively.
OpenJDK 11 and Maven are available through `conda-forge` channel on [conda](https://conda.io), respectively.
```sh
conda install -c pkgs/main openjdk
conda install -c conda-forge maven
conda install -c conda-forge openjdk maven
```
Note that OpenJDK on the `conda-forge` channels does not ship with JavaFX and cannot be used.
axtimwalde marked this conversation as resolved.
Show resolved Hide resolved


#### Installation on Linux
Alternatively, you can install Java 11 and Maven manually. Java 11 (through [OpenJDK](https://openjdk.java.net/)) and Apache Maven are available for [installation on many Linux distributions](#installation-on-linux).
cmhulbert marked this conversation as resolved.
Show resolved Hide resolved

##### Arch Linux
```shell
pacman -S jdk8-openjdk
pacman -S java8-openjfx
pacman -S maven
```

##### Ubuntu
```shell
sudo apt install default-jre default-jdk
sudo apt install maven
sudo apt install openjfx
```

On Ubuntu 18.04, you will have to install OpenJFX 8 explicitly and then immediately pin this version:

```shell
sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2
sudo apt-mark hold openjfx libopenjfx-java libopenjfx-jni
```

If you are on 18.10 or newer, add the bionic repositories following instruction on https://bugs.launchpad.net/ubuntu/+source/openjfx/+bug/1799946:
```shell
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
sudo apt-add-repository 'deb http://de.archive.ubuntu.com/ubuntu/ bionic main'
sudo apt-add-repository 'deb http://de.archive.ubuntu.com/ubuntu/ bionic universe'
```
On Windows and macOS the use of [Oracle Java 11](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html) is recommended and [Apache Maven needs to be downloaded and installed](https://maven.apache.org) manually. Make sure that both Java and Maven are available on the `PATH` after installation. Note that our experience with Windows and macOS installations is very limited and there may be better ways to install Java 11 and Maven on these operating systems. If you are aware of any, please create a pull request to add these to this README.
cmhulbert marked this conversation as resolved.
Show resolved Hide resolved

### Conda
Installation through conda requires an [installation of the conda package manager](https://docs.conda.io/projects/conda/en/latest/user-guide/install/).
Expand All @@ -77,21 +46,15 @@ Paintera can then be executed with the `paintera` command:
```
paintera [[JGO ARG...] [JVM ARG...] --] [ARG...]
```
By default, `org.slf4j:slf4j-simple` is used as `slf4j` binding for logging. This can be replaced by setting the `PAINTERA_SLF4J_BINDING` environment variable:
```bash
PAINTERA_SLF4J_BINDING=groupId:artifactId[:version]
```
For example, to replace `org.slf4j:slf4j-simple` with `ch.qos.logback:logback-classic`, run (on Linux/OSX):
```
PAINTERA_SLF4J_BINDING=ch.qos.logback:logback-classic paintera
```

### Pip
Note: If installing via pip, it will be necessary to have Java 11 and Maven installed manually.
cmhulbert marked this conversation as resolved.
Show resolved Hide resolved

Paintera is [available on the Python Package Index](https://pypi.org/project/paintera) and can be installed through pip ([`Python >= 3.6`](https://www.python.org) required):
```sh
pip install paintera
```
Generally, it is adivsable to install packages into user space with pip, i.e.
Generally, it is advisable to install packages into user space with pip, i.e.
```sh
pip install --user paintera
```
Expand All @@ -104,49 +67,58 @@ Paintera can then be executed with the `paintera` command:
```
paintera [[JGO ARG...] [JVM ARG...] --] [ARG...]
```
By default, `org.slf4j:slf4j-simple` is used as `slf4j` binding for logging. This can be replaced by setting the `PAINTERA_SLF4J_BINDING` environment variable:
axtimwalde marked this conversation as resolved.
Show resolved Hide resolved
```bash
PAINTERA_SLF4J_BINDING=groupId:artifactId[:version]
```
For example, to replace `org.slf4j:slf4j-simple` with `ch.qos.logback:logback-classic`, run (on Linux/OSX):
```
PAINTERA_SLF4J_BINDING=ch.qos.logback:logback-classic paintera
```

### Jgo
You can use [jgo](https://github.com/scijava/jgo) to run Paintera from an existing Maven artifact on the [SciJava Maven repository](https://maven.scijava.org) or your local maven repository, typically located at `$HOME/.m2` on your computer. Jgo is available through PyPI and conda. Please follow the instructions on the [jgo GitHub repository](https://github.com/scijava/jgo#the-python-module) for installation.
We recommend setting these JVM options:

```sh
jgo \
[JGO ARG...] [JVM ARG...] \
-r scijava.public=https://maven.scijava.org/content/groups/public \
org.janelia.saalfeldlab:paintera[:$VERSION][+org.slf4j:slf4j-simple:1.7.25]
```
Brackets indicate optional parts of the command that can be used to specify a version other than the latest release (`[:$VERSION]`, e.g. 0.17.1-SNAPSHOT) or add logging (`+org.slf4j:slf4j-simple:1.7.25`). `slf4j-simple` can be replaced with any [`slf4j` binding](https://www.slf4j.org/manual.html#swapping) in the appropriate version (currently `1.7.25`). The `-r scijava.public=https://maven.scijava.org/content/groups/public` option adds the [SciJava Maven repository](https://maven.scijava.org/) and can be omitted if [`$HOME/.jgorc` is set up appropriately](https://github.com/scijava/jgo#repositories).
|Option| Description|
| ---- | ---------- |
| -Xmx16G | Maximum Java heap space (replace 16G with desired amount) |
| -XX:+UseConcMarkSweepGC | Concurrent garbage collector, generally better for UI applications |

Current development on master or feature branches can be installed through maven and subsequently executed through jgo:
## Running from source

Clone the paintera git repository:
```sh
git clone https://github.com/saalfeldlab/paintera
git clone https://github.com/saalfeldlab/paintera.git
cd paintera
# optionally checkout a feature branch (skip if running on master)
git checkout <branch-name>
mvn clean install
# maven will log the version it installs. Replace <VERSION> below with that version
jgo \
[JGO ARG...] [JVM ARG...] \
org.janelia.saalfeldlab:paintera:<VERSION>+org.slf4j:slf4j-simple:1.7.25
```
The `-r` flag can be ommitted here because Paintera is available in the local maven repository.

We recommend setting these JVM options:
To run Paintera from source requires slightly different dependencies. Maven can be installed as indicated in the [dependencies](#Dependencies) section. However, compiling the java sources requires Java 13 or newer. Java 13 can be installed from [openjdk](#https://jdk.java.net/archive/), but it is easier at the moment to install Java 15, as it's the latest stable JDK version. Java 15 can be downloaded from [openjdk](#https://jdk.java.net/15/) as well.

|Option| Description|
| ---- | ---------- |
| -Xmx16G | Maximum Java heap space (replace 16G with desired amount) |
| -XX:+UseConcMarkSweepGC | Concurrent garbage collector, generally better for UI applications |
### Source Dependencies via sdkman
Alternatively, you can utilize [sdkman](#https://sdkman.io/install) to manage the appropriate java version. Install sdkman as follows:

*Note*: If using windows, the following sdk commands must be run via either [WSL](#https://docs.microsoft.com/en-us/windows/wsl/install-win10), [Cygwin](#https://www.cygwin.com/install.html) or [Git Bash For Windows](#https://git-scm.com/download/win). For Windows installation instructions, please follow the [Windows Installtion](#https://sdkman.io/install) instructions.

```shell
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
```

Once sdkman is installed, you can install the appropriate java version with:
```shell
sdk install java 15
```
`sdk` will then prompt whether to change to that version of java for your system default. If you say "No", then you will want to specify that you'd like to use Java 15 locally in your paintera directory. To do this, navigate to the `paintera` directory cloned in the above step, and execute:
```shell
sdk use java 15
# verify active version
sdk current java
```

Similarly, you can install maven via `sdkman` if you desire:
```shell
sdk install maven
```

### Running Paintera
To run paintera, execute the follow maven goal:
```sh
mvn javafx:run
```

## Display help message and command line parameters
The following assumes that Paintera was installed through [conda](#conda) or [pip](#pip) and the `paintera` command is available on the command line. Replace `paintera` with an appropriate substitute if executed in a different way, e.g. through [jgo](#jgo).
The following assumes that Paintera was installed through [conda](#conda) or [pip](#pip) and the `paintera` command is available on the command line.
```shell
$ paintera --help
Usage: Paintera [--add-n5-container=<container>...
Expand Down
9 changes: 4 additions & 5 deletions create-changelog.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ data class Change(
val author: String,
val message: String,
val date: String) {
constructor(commit: JSONObject) : this(
sha = commit.getString("sha"),
author = (commit["author"] as JSONObject).getString("login"),
message = (commit["commit"] as JSONObject).getString("message"),
date = (((commit["commit"] as JSONObject)["author"] as JSONObject)).getString("date"))
constructor(commit: JSONObject) : this(sha = commit.getString("sha"),
author = if (commit.isNull("author")) "NULL" else (commit["author"] as JSONObject).getString("login"),
message = (commit["commit"] as JSONObject).getString("message"),
date = if (commit.isNull("author")) "NULL" else (((commit["commit"] as JSONObject)["author"] as JSONObject)).getString("date"))
}

fun versionFromString(str: String): Version {
Expand Down
Loading