compile problem on ubuntu

Hi, there

When I try to compile from the source with java 9 or above, it will give me the following errors, do I have to compile with java 8 or below? thanks in advance

Nov 11, 2019 10:56:01 AM mpi.eudico.client.annotator.ELAN main
INFO:
Nov 11, 2019 10:56:01 AM mpi.eudico.client.annotator.ELAN main
INFO: ELAN 5.8
Java home: /usr/lib/jvm/java-9-openjdk-amd64
Java version: 9.0.4
Runtime: 9.0.4+12-Ubuntu-4ubuntu216.04.4
OS name: Linux
OS version: 4.15.0-66-generic
OS arch.: amd64
User language: en
User home: /home/seamanj
User dir: /home/seamanj/Workspace/elan-5.8/target/classes
Classpath: /home/seamanj/Workspace/elan-5.8/target/classes:/home/seamanj/.m2/repository/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar:/home/seamanj/.m2/repository/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar:/home/seamanj/.m2/repository/xalan/xalan/2.4.1/xalan-2.4.1.jar:/home/seamanj/.m2/repository/javax/help/javahelp/2.0.05/javahelp-2.0.05.jar:/home/seamanj/.m2/repository/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.jar:/home/seamanj/.m2/repository/javax/graphics/jlfgr/1.0/jlfgr-1.0.jar:/home/seamanj/.m2/repository/uk/gate/guk/0.7/guk-0.7.jar:/home/seamanj/.m2/repository/com/apple/AppleJavaExtensions/1.0/AppleJavaExtensions-1.0.jar:/home/seamanj/.m2/repository/nl/mpi/annot/search/mfsearch/1.5.7/mfsearch-1.5.7.jar:/home/seamanj/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar:/home/seamanj/.m2/repository/nl/mpi/annot/annot-tools/1.1.12/annot-tools-1.1.12.jar:/home/seamanj/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar:/home/seamanj/.m2/repository/nl/mpi/annot/search/annot-search-lib/1.4.11/annot-search-lib-1.4.11.jar:/home/seamanj/.m2/repository/nl/mpi/lexan/lexan-api/0.9/lexan-api-0.9.jar:/home/seamanj/.m2/repository/nl/mpi/lexiconcomponent/1.6/lexiconcomponent-1.6.jar:/home/seamanj/.m2/repository/uk/co/caprica/vlcj/4.2.0/vlcj-4.2.0.jar:/home/seamanj/.m2/repository/uk/co/caprica/vlcj-natives/4.1.0/vlcj-natives-4.1.0.jar:/home/seamanj/.m2/repository/net/java/dev/jna/jna/5.4.0/jna-5.4.0.jar:/home/seamanj/.m2/repository/net/java/dev/jna/jna-platform/5.4.0/jna-platform-5.4.0.jar:/home/seamanj/.m2/repository/nl/mpi/metadata-api/1.5.0/metadata-api-1.5.0.jar:/home/seamanj/.m2/repository/org/apache/xmlbeans/xmlbeans/2.6.0/xmlbeans-2.6.0.jar:/home/seamanj/.m2/repository/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar:/home/seamanj/.m2/repository/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar:/home/seamanj/.m2/repository/org/apache/httpcomponents/httpclient/4.4.1/httpclient-4.4.1.jar:/home/seamanj/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/seamanj/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:/home/seamanj/.m2/repository/de/saga/staccato/1.0.0/staccato-1.0.0.jar:/home/seamanj/.m2/repository/eu/dasish/annotation-schema/1.0/annotation-schema-1.0.jar:/home/seamanj/.m2/repository/com/atlascopco/hunspell-bridj/1.0.4/hunspell-bridj-1.0.4.jar:/home/seamanj/.m2/repository/com/nativelibs4java/bridj/0.7.0/bridj-0.7.0.jar:/home/seamanj/.m2/repository/com/google/android/tools/dx/1.7/dx-1.7.jar:/home/seamanj/.m2/repository/org/json/json/20160212/json-20160212.jar:/home/seamanj/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar:/home/seamanj/.m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar:/home/seamanj/.m2/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar:/home/seamanj/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-controls/11/javafx-controls-11.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-controls/11/javafx-controls-11-linux.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-graphics/11/javafx-graphics-11.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-graphics/11/javafx-graphics-11-linux.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-base/11/javafx-base-11.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-base/11/javafx-base-11-linux.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-media/11/javafx-media-11.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-media/11/javafx-media-11-linux.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-swing/11/javafx-swing-11.jar:/home/seamanj/.m2/repository/org/openjfx/javafx-swing/11/javafx-swing-11-linux.jar
Library path: /usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib;/home/seamanj/Workspace/elan-5.8/target/nativelib
Display info:
Screen 1 - isDefault:true, w:1920, h:1080, bitDepth:-1
Screen 2 - isDefault:false, w:1920, h:1200, bitDepth:-1
Main screen resolution:96 (w:1920, h:1080)

Nov 11, 2019 10:56:01 AM mpi.eudico.client.annotator.ELAN initPlatformPreferences
WARNING: Could not create the application’s data directory or apply some preferences: Unresolved compilation problems:
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
The package org.xml.sax.helpers is accessible from more than one module: <unnamed>, java.xml
ContentHandler cannot be resolved to a type
XMLReader cannot be resolved to a type
XMLReader cannot be resolved to a type
XMLReaderFactory cannot be resolved
XMLReader cannot be resolved to a type
XMLReader cannot be resolved to a type
XMLReader cannot be resolved to a type
XMLReader cannot be resolved to a type
XMLReader cannot be resolved to a type
XMLReader cannot be resolved to a type
SAXException cannot be resolved to a type
XMLReader cannot be resolved to a type
InputSource cannot be resolved to a type
InputSource cannot be resolved to a type
XMLReader cannot be resolved to a type
Attributes cannot be resolved to a type
SAXException cannot be resolved to a type
The method endElement(String, String, String) of type PreferencesReader must override or implement a supertype method
SAXException cannot be resolved to a type
The method characters(char[], int, int) of type PreferencesReader must override or implement a supertype method
SAXException cannot be resolved to a type
The method endDocument() of type PreferencesReader must override or implement a supertype method
SAXException cannot be resolved to a type
The method endPrefixMapping(String) of type PreferencesReader must override or implement a supertype method
SAXException cannot be resolved to a type
The method ignorableWhitespace(char[], int, int) of type PreferencesReader must override or implement a supertype method
SAXException cannot be resolved to a type
The method processingInstruction(String, String) of type PreferencesReader must override or implement a supertype method
SAXException cannot be resolved to a type
Locator cannot be resolved to a type
The method skippedEntity(String) of type PreferencesReader must override or implement a supertype method
SAXException cannot be resolved to a type
The method startDocument() of type PreferencesReader must override or implement a supertype method
SAXException cannot be resolved to a type
The method startPrefixMapping(String, String) of type PreferencesReader must override or implement a supertype method
SAXException cannot be resolved to a type
ErrorHandler cannot be resolved to a type
SAXParseException cannot be resolved to a type
SAXException cannot be resolved to a type
SAXParseException cannot be resolved to a type
SAXException cannot be resolved to a type
SAXParseException cannot be resolved to a type
SAXException cannot be resolved to a type

Exception in thread “main” java.lang.NoClassDefFoundError: Could not initialize class mpi.eudico.client.annotator.Preferences
at mpi.eudico.client.annotator.ELAN.updateUIDefaults(ELAN.java:343)
at mpi.eudico.client.annotator.ELAN.main(ELAN.java:81)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------

The 5.8 sources assume jdk 9 (but have mostly been tested with openjdk 11). But since the project is in a transition phase from Java 1.6 compatible to Java 9 or above, the Maven build file isn’t fully adapted yet.

It was only last week that we encountered the same error message as yours on one of our systems:
“The package org.xml.sax is accessible from more than one module: , java.xml”
which seems to be caused by “xml-apis-1.4.01.jar” on the classpath (although it doesn’t seem to be a problem on all/most systems). This jar is an inherited dependency and we still have to check where to exclude it.

You might have less problems with the sources of ELAN 5.4 in combination with Java 1.8?

-Han

Thanks, Han

I found the solution to this problem. please see the link below for your reference:

https://stackoverflow.com/questions/51094274/eclipse-cant-find-xml-related-classes-after-switching-build-path-to-jdk-10

Specifically, I exclude it in eclipse following the steps below:

  1. properites->configure->create module-info.java
  2. properites->Java Build Path
    exclude xml.apis by double clicking it from the right to the left.

Just out of curiosity, could I ask which IDE do you guys use to develop ELAN?

Thanks!

Ah, I assumed you tried to compile and run with Maven from the command line. That is sort-of the “reference build”, the build that should work.
Eclipse is and has been the favorite IDE for most of the developers who contributed to ELAN here at the MPI. But that shouldn’t really matter.
Depending on the version of Eclipse and on the way the code is run (as an Eclipse project and run target or as a Maven plugin run target), one can encounter different problems.
Apart from that, turning the ELAN source code into one or more Java modules is (high) on the to-do list.

Many thanks for your help, Han :slight_smile:

Dear Han

I met another question when I try to open the AboutPanel.java in Design page of Window builder in Eclipse. It says

Different parents for double associations
The gbc component is added to a parent component more than once.

I was just wondering If developers are unable to open in design mode, how will they to design the window layout?

Thanks in advance.

I stopped using a visual designer or window builder a long time ago. The alternative is (indeed) to hand code the layout of windows and dialogs.

I don’t know, but if you (temporarily) add a main() to a dialog or window it might be possible to open it in Window Builder? In case of a panel (like the AboutPanel) you might have to embed it in a JFrame for that purpose? I don’t know.

Dear Han,

Many thanks for your patience.

After searching, I found a solution to that. Instead of using gbc, we could use gbc.clone(), in this way we are able to open it in window builder.

But still, I may prefer hand code as well. Thanks again :slight_smile: