目录
JabRef error caused by unsupported Java
With my Ubuntu installation, I got error “java.lang.noclassdeffounderror: javafx/application/application” running JabRef-4.3.1.jar.
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.
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:
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.
/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:
- Create a shell script file “jabref” with the code below in the folder ~/bin.
#!/bin/sh
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar ~/apps/JabRef-4.3.1.jar -desktop
- Create a desktop file “jabref.desktop” with the code below in the folder ~/.local/share/applications.
[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