Open mickaelistria opened 1 year ago
where is java-openjdk-latest installed? Do you know how does Eclipse find it automatically?
where is java-openjdk-latest installed?
/usr/lib/jvm/...
Do you know how does Eclipse find it automatically?
I tried a fresh workspace and it doesn't seem to find it automatically. I imagine I had it configured a while ago and the symlink magic does the trick to detect version change. I will open an issue to JDT Core about looking up Java installation from usual folders.
I've opened https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/230 for JDT, I think it's the best place to host the fix. In the meantime, it would still be convenient if JDT-LS offered a quick-fix to assist users in binding the JRE to an installation.
And a PR for JDT debug (core and UI) https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/230 . When this is merged, then my case of standard Java 19 not being detected should be automatically resolved.
I think, this can happen if an unsupported JDK version is used. As of today, this is JDK 20.
I am using devcontainer's java feature, which uses SDK man to install the JDK. That puts the JDK in /usr/local/sdkman/candidates/java/current
(and sets JAVA_HOME
correctly). When putting that path as java.jdt.ls.java.home
, the import by the normal Java extension works. When executing the debugger, that one fails with
Unbound classpath container: 'JRE System Library [JavaSE-20]'
I did not find any hint to configure the JDK at https://code.visualstudio.com/docs/java/java-debugging.
It turns out that I needed to go back to JDK 19.
Adding following to .vsdoce/settings.json
was not necessary:
"java.configuration.runtimes": [
{
"name": "JavaSE-19",
"path": "/usr/local/sdkman/candidates/java/current"
}
]
On my machine, I have Java 19 installed in a standard location. Both CLI or Eclipse IDE do find it properly apparently. When trying to open a project defined in Eclipse IDE and that requires Java 19 (working fine in Eclipse IDE), vscode-java throws tons of errors with no assistance/quickfix to remediate those.
Environment
Steps To Reproduce
dnf install java-openjdk-latest
testProject.zip
Current Result
Unbound classpath container: 'JRE System Library [JavaSE-19]' in project 'sandboxJava'
message and tons of unresolved types from the JREExpected Result
Everything fine
Additional Informations
I would expect JDT-LS to detect Java 19 from such a standard directory; and also to provide an helpful quickfix about remediation (even just linking to documentation would be better)