protegeproject / protege

Protege Desktop
http://protege.stanford.edu
Other
975 stars 231 forks source link

Upgrade Protege to Java 11 #822

Open matthewhorridge opened 5 years ago

matthewhorridge commented 5 years ago

Relevant issue: https://github.com/protegeproject/protege/issues/702#issuecomment-451423167

matthewhorridge commented 5 years ago

Relevant issue: https://github.com/protegeproject/protege/issues/753

matthewhorridge commented 5 years ago

Relevant issue: https://github.com/protegeproject/protege/issues/732

csnyulas commented 5 years ago

Relevant issue: #825

matthewhorridge commented 5 years ago

Ensure that performance is ok. See #723

ykazakov commented 5 years ago

B.t.w., how do you plan go about the new Java licensing model? Switch to OpenJDK?

matthewhorridge commented 5 years ago

For Java 11? Yes, we'll switch to OpenJDK. We've done this for WebProtege.

ykazakov commented 5 years ago

Does Protege work well with OpenJDK? I did not test. I think even for Java 8 the updates of Oracle JDK will no longer be free.

matthewhorridge commented 5 years ago

I need to double check both of these things

ykazakov commented 5 years ago

OK, I just tried Protege with OpenJDK on MacOS 10.14.2: openjdk version "1.8.0_192" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_192-b12) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.192-b12, mixed mode) From: https://adoptopenjdk.net Everything feels and looks just like for Oracle JDK, including the issue #723.
Just icons look funny.

screenshot 2019-01-17 at 23 11 01
matthewhorridge commented 5 years ago

Awesome @ykazakov! Funny icons. Will have to look into this.

matthewhorridge commented 5 years ago

For Java 8, my understanding is that we can still distribute the JRE without problems. There just won't be anymore public updates for Java 8.

woutermont commented 5 years ago

How is this coming along? The issue referenced above (#732, #753 and #825) still occurs when running 5.5-beta9 on Linux with Java 11.

ykazakov commented 5 years ago

@woutermont have you checked if the branch referenced in #732 works for Java11? The current release 5.5-beta9 is for Java 8. It is unlikely that the same version of Protege will work for both Java 8 and Java 11 as there are some incompatibilities (see #732).

woutermont commented 5 years ago

@ykazakov my bad, I thought support for Java 11 was supposed to be ready now ... The fork doesn't work either though.

ykazakov commented 5 years ago

@woutermont if it were ready, this ticked would be closed ;-) What is exactly in the fork not working for Java 11? @wismill mentioned that his modifications are working for Java 10.

woutermont commented 5 years ago

@ykazakov just the same error as mentioned in the issues, does that make sense?

ykazakov commented 5 years ago

@woutermont from which of the two branches did you build Protege? The osgi.ee error should have been fixed by the newer version of Apache Felix.

ykazakov commented 5 years ago

I just tried this branch on mac os 10.14.2: works fine with java 10.0.2 but not with 11.0.2:

CompileCommand: exclude javax/swing/text/GlyphView.getBreakSpot
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.xml.bind not found
ykazakov commented 5 years ago

Probably related to this.

woutermont commented 5 years ago

@woutermont from which of the two branches did you build Protege?

Ah, damn, again, my bad ... correct branch indeed gives the java.xml.bind error. Similar for the other solution offered in that same issue.

ykazakov commented 5 years ago

I think I fixed the errors. Could you give it a try? https://github.com/liveontologies/protege/tree/feature/java11 I also created a PR based on this, but it requires some further testing.

woutermont commented 5 years ago

@ykazakov that seems to work! I'll work a bit with it and report any problems ...

serasset commented 3 years ago

As I wanted to run Protege on my ARM M1 Mac natively, I had to use @ykazakov branch and I can confirm that it builds and runs correctly under the ARM native versio of openjdk@11 (installed using homebrew).

openjdk version "11.0.9" 2020-10-20 OpenJDK Runtime Environment (build 11.0.9+11) OpenJDK 64-Bit Server VM (build 11.0.9+11, mixed mode)

Thanks !

ykazakov commented 3 years ago

@serasset Nice! I did not know that there is already a native java vor M1.

mickbaggen commented 3 years ago

Any chance that Protege 5.5 will be upgraded to run under OpenJDK 11 (or later)? This issue is already quite old...

AndrewSmart commented 3 years ago

For security I like to wrap everything in Firejail, including Java. To use Java 11, in addition to the changes mentioned above, for the swrltab plugin I also had to download a CORBA implementation as CORBA was removed from Java 11. Here are the errors on launch regarding swrltab, which were later fixed with the CORBA implementation download:

Starting bundle swrltab-plugin 
Jul 09, 2021 3:13:05 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Error starting file:/opt/Protege-5.5.0/plugins/swrltab-plugin-2.0.6.jar 
org.osgi.framework.BundleException: Unable to resolve swrltab-plugin [33](R 33.0): missing requirement [swrltab-plugin [33](R 33.0)] osgi.wiring.package; (osgi.wiring.package=org.omg.CORBA) Unresolved requirements: [[swrltab-plugin [33](R 33.0)] osgi.wiring.package; (osgi.wiring.package=org.omg.CORBA)]
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4398) ~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2308) ~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1566) ~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) ~[org.apache.felix.main.jar:na]
    at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

Plugin: SWRLTab Protege 5.0+ Plugin (2.0.6) was not successfully started.  Please see the Protégé log for more details.

Without having to setup and re-learn an environment for Java development, I manually downloaded the newer Felix from here, javax.xml.bind jar and dependencies from here, and CORBA implementation jar and dependencies from here. I placed those 6 new jars in Protege-5.5.0/bin/ also renaming the Felix jar to match what was in run.sh. Dependency links are at the right side on the bottom on each of those Maven web pages.

In run.sh in addition to javax.xml.bind I added jacorb: --add-modules javax.xml.bind,jacorb \

Works. I should note that the glassfish-corba-orb CORBA implementation might have better performance than the JacORB implementation so feel free to benchmark if that matters... I just picked the JacORB implementation as it was less jars to download manually.

RalphBln commented 2 years ago

Regarding https://github.com/protegeproject/protege/issues/822#issuecomment-877488750: 9d8c0d4afde21ae4435b3bbc08fa772f5a395128 takes care of this. @matthewhorridge: I can create a pull request if you are interested.