Skip to content

Instantly share code, notes, and snippets.

@wvengen
Last active Dec 13, 2019
Embed
What would you like to do?
Run OpenLabeler with system Java

OpenLabeler is a pretty nice image annotation package, but I had issues getting it to run. Plus I'd rather use the system-supplied Java environment, instead of a bundled one, and install it for a user (not in the system).

This happens on a Debian or Ubuntu system (with apt and deb tools available).

  1. Download deb package of latest release.
  2. Extract its contents: dpkg-deb -x ~/.local/openlabeler openlabeler-1.2.0.deb
  3. Make sure you have OpenJDK 11 installed plus apt install libopenjdk-11-jre libopenjfx-java
  4. Cleanup directory structure: cd ~/.local/openlabeler && mv opt/OpenLabeler/* . && rmdir opt/OpenLabeler opt
  5. Move run.sh to the same directory, and symlink it from e.g. ~/.local/bin/openlabeler
  6. Remove the OpenLabeler-bundled Java runtime: rm -Rf ~/.local/openlabeler/runtime (it's 500MB!)
#!/bin/sh
BASE=$(cd `dirname "$0"` && pwd)
CFG="$BASE/app/OpenLabeler.cfg"
# construct classpath
LIBJARS=`sed 's/^app\.classpath=//p;d' < "$CFG"`
LIBJARS="$BASE/app/"`echo "$LIBJARS" | sed -E "s|:|:$BASE/app/|g"`
MAINJAR="$BASE/app/"`sed 's/^app\.mainjar=//p;d' < "$CFG"`
# get main class (need dots instead of slashes to run)
MAINCLS=`sed 's/^app\.mainclass=//p;d' < "$CFG"`
MAINCLS=`echo "$MAINCLS" | sed 's/\//./g'`
# we also need system JavaFX
if [ ! -e /usr/share/java/javafx-base.jar ]; then
echo "Please: apt-get install libopenjfx-java" 1>&2
exit 1
fi
JFXJARS=/usr/share/java/javafx-base.jar:/usr/share/java/javafx-controls.jar:/usr/share/java/javafx-fxml.jar:/usr/share/java/javafx-graphics.jar:/usr/share/java/javafx-media.jar:/usr/share/java/javafx-swing.jar:/usr/share/java/javafx-web.jar
java -cp "$MAINJAR:$LIBJARS:$JFXJARS" "$MAINCLS" $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment