JabRef error caused by unsupported Java

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:

  1. 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
  1. 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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值