Cannot start JabRef 3.7/3.6 using Java 9 on Ubuntu 16.04

Hi,

I was excited to download the latest JabRef on my Ubuntu 16.04. But then I got some error:

$ java -jar JabRef-3.7.jar 
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at net.sf.jabref.logic.importer.ImportFormatReader.resetImportFormats(ImportFormatReader.java:60)
at net.sf.jabref.JabRefMain.start(JabRefMain.java:74)
at net.sf.jabref.JabRefMain.lambda$main$0(JabRefMain.java:39)
at java.awt.event.InvocationEvent.dispatch(java.desktop@9-ea/InvocationEvent.java:313)
at java.awt.EventQueue.dispatchEventImpl(java.desktop@9-ea/EventQueue.java:759)
at java.awt.EventQueue.access$500(java.desktop@9-ea/EventQueue.java:97)
at java.awt.EventQueue$3.run(java.desktop@9-ea/EventQueue.java:712)
at java.awt.EventQueue$3.run(java.desktop@9-ea/EventQueue.java:706)
at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-ea/ProtectionDomain.java:78)
at java.awt.EventQueue.dispatchEvent(java.desktop@9-ea/EventQueue.java:729)
at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@9-ea/EventDispatchThread.java:199)
at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@9-ea/EventDispatchThread.java:124)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@9-ea/EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-ea/EventDispatchThread.java:109)
at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-ea/EventDispatchThread.java:101)
at java.awt.EventDispatchThread.run(java.desktop@9-ea/EventDispatchThread.java:90)
   Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-ea/BuiltinClassLoader.java:366)
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-ea/ClassLoaders.java:185)
at java.lang.ClassLoader.loadClass(java.base@9-ea/ClassLoader.java:419)
... 17 more

“Java -version” gives me:

java version "9-ea"
 Java(TM) SE Runtime Environment (build 9-ea+140)
 Java HotSpot(TM) 64-Bit Server VM (build 9-ea+140, mixed mode)

The same error occurs on JabRef V3.6. From my quick search, some library may be missing, but I haven’t found a way to solve it. Any insight will be appreciated.

Thanks!

I think your problem is related to the Java version you are using.

Java 9 introduced a new way handle dependencies. Some Java classes, which were previously part of the normal Java installation, aren’t automatically found now. Could you please try the following command, which according to google helps:

 `java -addmods java.se.ee -jar JabRef-3.7.jar`

or

 `java --add-modules=java.se.ee -jar JabRef-3.7.jar`
1 Like

The first code gives

$ java -addmods java.se.ee -jar Jabf-3.7.jar
Unrecognized option: -addmods
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

But the second code snippet seems working! Thanks. I will create a shortcut for this command line.

Uuh, found another problem: if I click on the Options/Preference button, it doesn’t open any window for me to change the preference, although there is a message saying “opening preferences”. The log is here

$ java --add-modules=java.se.ee -jar JabRef-3.7.jar
21:34:21.604 [AWT-EventQueue-0] INFO  net.sf.jabref.logic.importer.OpenDatabase - Opening: /media/E/References/Archive/Archive.bib
Exception in thread "AWT-EventQueue-0" java.lang.IllegalAccessError: superclass access check failed: class com.jgoodies.looks.windows.WindowsLookAndFeel (in unnamed module @0x7b75739c) cannot access class com.sun.java.swing.plaf.windows.WindowsLookAndFeel (in module java.desktop) because module java.desktop does not export com.sun.java.swing.plaf.windows to unnamed module @0x7b75739c
	at java.lang.ClassLoader.defineClass1(java.base@9-ea/Native Method)
	at java.lang.ClassLoader.defineClass(java.base@9-ea/ClassLoader.java:941)
	at java.security.SecureClassLoader.defineClass(java.base@9-ea/SecureClassLoader.java:150)
	at jdk.internal.loader.BuiltinClassLoader.defineClass(java.base@9-ea/BuiltinClassLoader.java:553)
	at jdk.internal.loader.BuiltinClassLoader.access$200(java.base@9-ea/BuiltinClassLoader.java:88)
	at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-ea/BuiltinClassLoader.java:466)
	at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-ea/BuiltinClassLoader.java:460)
	at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)
	at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(java.base@9-ea/BuiltinClassLoader.java:459)
	at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@9-ea/BuiltinClassLoader.java:406)
	at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-ea/BuiltinClassLoader.java:364)
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-ea/ClassLoaders.java:185)
	at java.lang.ClassLoader.loadClass(java.base@9-ea/ClassLoader.java:419)
	at java.lang.Class.forName0(java.base@9-ea/Native Method)
	at java.lang.Class.forName(java.base@9-ea/Class.java:291)
	at net.sf.jabref.gui.preftabs.AppearancePrefsTab$LookAndFeel.getAvailableLookAndFeels(AppearancePrefsTab.java:64)
	at net.sf.jabref.gui.preftabs.AppearancePrefsTab.<init>(AppearancePrefsTab.java:103)
	at net.sf.jabref.gui.preftabs.PreferencesDialog.<init>(PreferencesDialog.java:91)
	at net.sf.jabref.gui.JabRefFrame.showPreferencesDialog(JabRefFrame.java:740)
	at net.sf.jabref.gui.JabRefFrame$ShowPrefsAction.actionPerformed(JabRefFrame.java:1786)
	at javax.swing.AbstractButton.fireActionPerformed(java.desktop@9-ea/AbstractButton.java:1967)
	at javax.swing.AbstractButton$Handler.actionPerformed(java.desktop@9-ea/AbstractButton.java:2308)
	at javax.swing.DefaultButtonModel.fireActionPerformed(java.desktop@9-ea/DefaultButtonModel.java:404)
	at javax.swing.DefaultButtonModel.setPressed(java.desktop@9-ea/DefaultButtonModel.java:261)
	at javax.swing.AbstractButton.doClick(java.desktop@9-ea/AbstractButton.java:369)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(java.desktop@9-ea/BasicMenuItemUI.java:980)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(java.desktop@9-ea/BasicMenuItemUI.java:1024)
	at java.awt.AWTEventMulticaster.mouseReleased(java.desktop@9-ea/AWTEventMulticaster.java:297)
	at java.awt.Component.processMouseEvent(java.desktop@9-ea/Component.java:6575)
	at javax.swing.JComponent.processMouseEvent(java.desktop@9-ea/JComponent.java:3338)
	at java.awt.Component.processEvent(java.desktop@9-ea/Component.java:6340)
	at java.awt.Container.processEvent(java.desktop@9-ea/Container.java:2259)
	at java.awt.Component.dispatchEventImpl(java.desktop@9-ea/Component.java:4959)
	at java.awt.Container.dispatchEventImpl(java.desktop@9-ea/Container.java:2317)
	at java.awt.Component.dispatchEvent(java.desktop@9-ea/Component.java:4791)
	at java.awt.LightweightDispatcher.retargetMouseEvent(java.desktop@9-ea/Container.java:4896)
	at java.awt.LightweightDispatcher.processMouseEvent(java.desktop@9-ea/Container.java:4533)
	at java.awt.LightweightDispatcher.dispatchEvent(java.desktop@9-ea/Container.java:4474)
	at java.awt.Container.dispatchEventImpl(java.desktop@9-ea/Container.java:2303)
	at java.awt.Window.dispatchEventImpl(java.desktop@9-ea/Window.java:2758)
	at java.awt.Component.dispatchEvent(java.desktop@9-ea/Component.java:4791)
	at java.awt.EventQueue.dispatchEventImpl(java.desktop@9-ea/EventQueue.java:761)
	at java.awt.EventQueue.access$500(java.desktop@9-ea/EventQueue.java:97)
	at java.awt.EventQueue$3.run(java.desktop@9-ea/EventQueue.java:712)
	at java.awt.EventQueue$3.run(java.desktop@9-ea/EventQueue.java:706)
	at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-ea/ProtectionDomain.java:78)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-ea/ProtectionDomain.java:88)
	at java.awt.EventQueue$4.run(java.desktop@9-ea/EventQueue.java:734)
	at java.awt.EventQueue$4.run(java.desktop@9-ea/EventQueue.java:732)
	at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-ea/ProtectionDomain.java:78)
	at java.awt.EventQueue.dispatchEvent(java.desktop@9-ea/EventQueue.java:731)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@9-ea/EventDispatchThread.java:199)
	at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@9-ea/EventDispatchThread.java:124)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@9-ea/EventDispatchThread.java:113)
	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-ea/EventDispatchThread.java:109)
	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-ea/EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.run(java.desktop@9-ea/EventDispatchThread.java:90)

Thanks for your report! We currently put this issue on hold as Java 9 ist still in developmennt and there is no release yet.
For the moment it is the best to install java8.

1 Like

Your issue should be fixed in the latest build from http://builds.jabref.org/master/.

The new build fixed the menu problem, but I still need to add the --add-modules=java.se.ee switch in the terminal to open the program. I can wait for future release for a complete support of Java9 because some of my programs rely on Java9. Anyway, thank you for looking into this issue.

Using Java 9 (build 9-ea+157) under Debian, both JabRef 3.8.2 and 4.0.0 are unable to run passing --add-modules=java.se.ee:

JabRef 3.8.2:

$ java --add-modules=java.se.ee -jar JabRef-3.8.2.jar
22:56:28.724 [AWT-EventQueue-0] ERROR net.sf.jabref.FallbackExceptionHandler - Uncaught exception Occurred in Thread[AWT-EventQueue-0,6,main]
java.lang.Error: Unable to make void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional) accessible: module java.desktop does not "opens java.awt" to unnamed module @615713f8
	at spin.off.AWTReflectDispatcherFactory.<clinit>(AWTReflectDispatcherFactory.java:139) ~[JabRef-3.8.2.jar:?]
	at spin.off.SpinOffEvaluator.<clinit>(SpinOffEvaluator.java:38) ~[JabRef-3.8.2.jar:?]
	at spin.Spin.<clinit>(Spin.java:67) ~[JabRef-3.8.2.jar:?]
	at net.sf.jabref.gui.worker.AbstractWorker.<init>(AbstractWorker.java:21) ~[JabRef-3.8.2.jar:?]
	at net.sf.jabref.gui.openoffice.OpenOfficePanel.<init>(OpenOfficePanel.java:112) ~[JabRef-3.8.2.jar:?]
	at net.sf.jabref.gui.JabRefFrame.initSidePane(JabRefFrame.java:716) ~[JabRef-3.8.2.jar:?]
        ...

JabRef 4.0.0:

$ java --add-modules=java.se.ee -jar JabRef-4.0.0.jar
23:00:42.266 [AWT-EventQueue-0] ERROR org.jabref.FallbackExceptionHandler - Uncaught exception Occurred in Thread[AWT-EventQueue-0,6,main]
java.lang.Error: Unable to make void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional) accessible: module java.desktop does not "opens java.awt" to unnamed module @3aba1890
	at spin.off.AWTReflectDispatcherFactory.<clinit>(AWTReflectDispatcherFactory.java:139) ~[JabRef-4.0.0.jar:?]
	at spin.off.SpinOffEvaluator.<clinit>(SpinOffEvaluator.java:38) ~[JabRef-4.0.0.jar:?]
	at spin.Spin.<clinit>(Spin.java:67) ~[JabRef-4.0.0.jar:?]
	at org.jabref.gui.worker.AbstractWorker.<init>(AbstractWorker.java:21) ~[JabRef-4.0.0.jar:?]
	at org.jabref.gui.openoffice.OpenOfficePanel.<init>(OpenOfficePanel.java:112) ~[JabRef-4.0.0.jar:?]
	at org.jabref.gui.JabRefFrame.initSidePane(JabRefFrame.java:682) ~[JabRef-4.0.0.jar:?]
	at org.jabref.gui.JabRefFrame.init(JabRefFrame.java:569) ~[JabRef-4.0.0.jar:?]
	at org.jabref.gui.JabRefFrame.<init>(JabRefFrame.java:453) ~[JabRef-4.0.0.jar:?]
       ...

As workaround, I’m launching JabRef 3.8.2 (this does not seem to work with the v4.0.0) using --add-opens=java.desktop/java.awt=ALL-UNNAMED:

java --add-modules=java.se.ee --add-opens=java.desktop/java.awt=ALL-UNNAMED -jar JabRef-3.8.2.jar

I hope this will be useful while waiting for the beta version of Java 9.

1 Like

Thank you very much for your report!

I have created an issue which makes it easier for us to track all specific java 9 erros:
https://github.com/JabRef/jabref/issues/2594

I will check if there is a workaround for getting it to run.

Regards

Hi,

I just tried one of the latest dev 4.0.0 versions and it works fine:
However, you have to use a special version in which all libraries are in an external folder and you then have to use the startup script.

Create it yoursefl:

You just need to clone the JabRef repo, and run ./gradlew build (ignore the failing tests). (To compile it, you temporarily need oracle JDK8 enabled)
It creates a tar and a zip file in \jabref\build\distributions

Extract the archive and in the \bin folder you have a Jabref.sh script. That works fine with java9.

I am using XUbuntu 16.04.2 LTS and started JabRef with the shell script and it works fine.
Java™ SE Runtime Environment (build 9-ea+158)
Java HotSpot™ 64-Bit Server VM (build 9-ea+158, mixed mode)