vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

have vscode-java detect jbang installed jdks

Open maxandersen opened this issue 1 year ago • 3 comments

would like to have vscode-java function if it can pick up jdk's installed by vscode-java.

so that if user have jbang installed vscode-java will also "just work".

I see issues mention detection is done by node-jdk-utils so I made https://github.com/Eskibear/node-jdk-utils/pull/18 which should add the base detection.

But I'm also seeing src/findJavaRuntimes.ts which does not seem to use node-jdk-utils.

maxandersen avatar Oct 05 '24 11:10 maxandersen

src/findJavaRuntimes was removed in #2246 (1.2.0). Is there some other extension you're seeing that still has that ?

rgrunber avatar Oct 07 '24 12:10 rgrunber

@rgrunber probably just github / google search leading me a stray.

so would https://github.com/Eskibear/node-jdk-utils/pull/18 make it work in vscode-java ?

maxandersen avatar Oct 09 '24 13:10 maxandersen

It should. Those jbang JDKs would be pick up through autodetection and sent to the language server.

rgrunber avatar Oct 09 '24 14:10 rgrunber

https://github.com/Eskibear/node-jdk-utils/pull/18 was merged...any eta on it being available in vscode-java?

it does not seem to be present :)

maxandersen avatar Jul 07 '25 16:07 maxandersen

Needs a release at https://github.com/Eskibear/node-jdk-utils/releases , then https://www.npmjs.com/package/jdk-utils?activeTab=versions .

rgrunber avatar Jul 07 '25 16:07 rgrunber

@maxandersen I've built v1.44.2025070813 in the pre-release stream, which contains the update to jdk-utils. Let me know if that fixes the issue.

rgrunber avatar Jul 08 '25 15:07 rgrunber

so I've switched to pre-release, I have java 11 and 21 installed in ~/.jbang/cache/jdks/* but on restart I still get:

"Please download and install a JDK to compile your project. You can configure your projects with different JDKs by the setting 'java.configuration.runtimes'"

is there a way for me to see which jdk locations Vscode-java have considered (and rejected?) as not good enough jdks for it to use?

maxandersen avatar Jul 09 '25 07:07 maxandersen

Any updates ?

maxandersen avatar Aug 20 '25 12:08 maxandersen

~~You should verify that you aren't overriding java.configuration.detectJdksAtStart. It needs to be set to true in order for the JDKs to be loaded into java.configuration.runtimes. It is the default option though.~~ I see it being detected for me.

Nevermind from above. I think the issue is not about auto-sending the JDKs, but in the startup code at https://github.com/redhat-developer/vscode-java/blob/053490ef0a7da1140ed19df474164595d8892f88/src/requirements.ts#L74-L107

Image

rgrunber avatar Aug 20 '25 15:08 rgrunber