Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not build Java 17 based projects with the openjdk version of openSUSE Leap #405

Closed
weberhofer opened this issue Sep 16, 2022 · 10 comments

Comments

@weberhofer
Copy link

weberhofer commented Sep 16, 2022

I have filed a bug at openSUSE Bugzilla too. Maybe the fix should be made in Eclipse, too. I'm quite sure, another ticket is related to this issue, too: microsoft/vscode-java-debug/issues/1212

BUG DESCRIPTION:
Whenever the latest version of Eclipse tries to build a Java 11 or Java 17 based project using Leap's openjdk-11 or openjdk-17 it throws errors with the following message:

Errors occurred during the build.
Errors running builder 'Java Builder' on project 'test'.
Cannot invoke org.eclipse.jdt.internal.compiler.util.JrtFileSystem.walkModuleImage(org.eclipse.jdt.internal.compiler.util.JRTUtil$JrtFileVisitor, int)"
because the return value of org.eclipse.jdt.internal.compiler.util.JRTUtil.getJrtSystem(java.io.File, String)" is null

The reason for this issue is, that Eclipse expects a file /usr/lib64/jvm/java-17-openjdk-17/release holding some version information. The file included in the Java installation included in Eclipse contains the following two lines:

JAVA_VERSION="17.0.4.1"
MODULES="java.base java.compiler java.datatransfer java.xml java.prefs java.desktop java.instrument java.logging java.management java.security.sasl java.naming java.rmi java.management.rmi java.net.http java.scripting java.security.jgss java.transaction.xa java.sql java.sql.rowset java.xml.crypto java.se java.smartcardio jdk.accessibility jdk.internal.jvmstat jdk.attach jdk.charsets jdk.compiler jdk.crypto.ec jdk.crypto.cryptoki jdk.dynalink jdk.internal.ed jdk.editpad jdk.hotspot.agent jdk.httpserver jdk.internal.le jdk.internal.opt jdk.internal.vm.ci jdk.internal.vm.compiler jdk.internal.vm.compiler.management jdk.jartool jdk.javadoc jdk.jcmd jdk.management jdk.management.agent jdk.jconsole jdk.jdeps jdk.jdwp.agent jdk.jdi jdk.jfr jdk.jlink jdk.jpackage jdk.jshell jdk.jsobject jdk.jstatd jdk.localedata jdk.management.jfr jdk.naming.dns jdk.naming.rmi jdk.net jdk.nio.mapmode jdk.random jdk.sctp jdk.security.auth jdk.security.jgss jdk.unsupported jdk.unsupported.desktop jdk.xml.dom jdk.zipfs"

Copying this file into /usr/lib64/jvm/java-17-openjdk-17/release solves that issue for me.

STEPS TO REPRODUCE THE ISSUE:

  • Start Eclipse 2022-09 on openSUSE Leap
  • Add a new JRE pointing to /lib64/jvm/java-17-openjdk-17
  • Switch the JavaSE-17 execution environment to use Leap's openjdk instead of the version coming with Eclipse
  • Create/Open a Java 17 based project, using the JavaSE-17 execution environment
  • Whenever Eclipse tries to build the project you should see errors.
@weberhofer
Copy link
Author

To make openJDK 11 usable I have executed

sudo sh -c 'echo "JAVA_VERSION=\"11.0.16.0\"" > /usr/lib64/jvm/java-11-openjdk-11/release'

@testforstephen
Copy link
Contributor

It can be reproduced using Eclipse 2022-09.

  • Install a JDK 11 in local machine, and manually remove release file under jdk home.
  • Add this JDK 11 as an installed JRE to Eclipse
  • Using New Java Project wizard to create a Java 11 project
  • You will see Eclipse throw a NPE exception as follows.
    image

This NPE happens at

getJrtSystem(image, null).walkModuleImage(visitor, notify);

It does not cover the JDK installation without release file well. This seems a recent regression.

@iloveeclipse
Copy link
Member

Install a JDK 11 in local machine, and manually remove release file under jdk home.

Is this a valid use case? Or are there "regular" JDK builds without release file?

@testforstephen
Copy link
Contributor

Is this a valid use case? Or are there "regular" JDK builds without release file?

We have seen multiple (5+) users reporting this issue on the JDT language server side recently, and it looks like there are some JDK distributions that don't carry release file. I suspect that these JDK distributions are not from the official JDK vendors.

@iloveeclipse
Copy link
Member

it looks like there are some JDK distributions that don't carry release file

Would be nice to know which distributions are affected.

@testforstephen
Copy link
Contributor

As this issue author @weberhofer mentioned, openSUSE Leap's openjdk doesn't provide release file.

@iloveeclipse
Copy link
Member

openSUSE Leap's openjdk

Where one can get this, and which exact version is affected?

@weberhofer
Copy link
Author

openSUSE is currently packaging those files in "java-XX-openjdk-jmods", but the packages will be updated to move the fle to the "headless" package.

This is the packagers response:
"It is really surpising that they depend on this file that is of no use to the jdk/jre unless you want to create a custom JDK. In our packages, the file is part of *-jmods. It is enough to install java-11-openjdk-jmods and/or java-17-openjdk-jmods and all will work as expected."

@iloveeclipse
Copy link
Member

Well, there are many surprising things in universe, the compiler dependency to the release file is just one of them.
I hesitate to fix this, because it looks the particular Java SDK wasn't fully installed and there are few workarounds available.

@fridrich
Copy link

Well, there are many surprising things in universe, the compiler dependency to the release file is just one of them. I hesitate to fix this, because it looks the particular Java SDK wasn't fully installed and there are few workarounds available.

"Wasn't fully installed" is pretty misleading. I made an arrangement for people that were hit by poorly thought-through design. There are different ways of getting version from a JRE. Reading the release file is not the canonical one. But never mind, I modified openSUSE/SUSE packages accordingly just to make users happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants