With my Ubuntu installation, I got error “java.lang.noclassdeffounderror: javafx/application/application” running JabRef-4.3.1.jar.

1
java -jar JabRef-4.3.1.jar

JabRef-4.3.1.jar depends on Java 8

Solution was found in this Issue. JabRef-4.3.1.jar requires Java 8, but the default-jdk in Ubuntu 18.04 is openjdk-11-jdk (Java 11), under which JabRef does not work. So first I have to remove openjfx of new version with “sudo apt purge openjfx”, then install the required version of openjfx.

1
sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2

Then mark those packages to be not upgraded:

1
sudo apt-mark hold openjfx libopenjfx-jni libopenjfx-java

This way, Openjdk-8-jre is installed. /usr/bin/java points to /etc/alternatives/java, and the latter points to /usr/lib/jvm/java-8-openjdk-amd64/bin/java. Then you shoud start JabRef properly with the command “java -jar JabRef-4.3.1.jar.

Happy ending, right? Only if it's the end of the story.

CUDA depends on Java 11

Here in my case, CUDA 10.2 is required to release the power of the GPU. However CUDA depends on Java 11 on Ubuntu 18.04. With the default installation of CUDA 10.2, Java 11 will be automatically installed, shifting the pointer /etc/alternatives/java to /usr/lib/jvm/java-11-openjdk-amd64/bin/java afterwards.

Therefore, both openjdk-8-jre and openjdk-11-jre are installed. JabRef-4.3.1.jar requires Java 8 while CUDA 10.2 requires Java 11. Java version need to be specified to make both software work.

Solution to the dilemma

What is necessary for CUDA is that the system default Java version, determined by /etc/alternatives/java, must point to /usr/lib/jvm/java-11-openjdk-amd64/bin/java. Which means, to start JabRef properly, I have to specify the executable program to Java 8.

1
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar JabRef-4.3.1.jar

I took the following steps to make a desktop application of JabRef:

  1. Create a shell script file “jabref” with the code below in the folder ~/bin.
1
2
#!/bin/sh
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar ~/apps/JabRef-4.3.1.jar -desktop
  1. Create a desktop file “jabref.desktop” with the code below in the folder ~/.local/share/applications.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[Desktop Entry]
Encoding=UTF-8
Name=JabRef
Comment=GUI for editing BibTex bibliographies
Exec=jabref %f
Icon=jabref
Terminal=false
Type=Application
Categories=Office;Database;
MimeType=text/x-bibtex;
X-Desktop-File-Install-Version=0.23
Name[zh_CN]=JabRef