You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
java.configuration.runtimes in settings.json are ignored #2001
There is no project yet -- I can't even establish a session with the JDK of choice. Also the plugin goes off and finds some Java JDK-s that are not the ones I wish to use. There does not seem to be any place were I can say what I need to use in the project.
Command 'Java: Open Java Language Server Log File' resulted in an error (command 'java.open.serverLog' not found)
Current Result
JDK-s configured do not show in the 'Configure Java Runtime' on any tab.
Expected Result
I at least wanted to see the Java versions I entered show up as project JDK-s
I would also like them to show in the list of "instaled Java-s"
I would like a place where I can explicitly specify which Java versions I want the Java Plugin to recognise -- ALL those I want to use at a particular time and No Other JDK-s even if there are installed.
Not all the relevant JDK-s are available in "expected" locations
It looks like you're using the "Configure Java Runtime" from https://github.com/microsoft/vscode-java-pack and there may be some limitations on how it can be configured. With that said, I think you need to have some project imported before being able to configure the runtime in the "Project JDKs" tab. Build systems tend to allow configuring the source/compiler targets, so usually such changes need to be made there. @testforstephen, thoughts ? There might be some enhancements that could be made to give users more control here.
The "Configure Java Runtime" doesn't seem to be reading in any values a user may have set in java.configuration.runtimes
Java commands contributed via package.json will fail if the extension itself hasn't been triggered (ie. due to no project imported). I wonder if we can fix this.
There may be some locations we miss for locating java installations, though we do check JAVA_HOME, JDK_HOME, PATH, and /usr/lib/jvm/ on Linux. Are there additional locations ?
When you open a workspace without a project, we leave the "Project JDKs" empty, which is by design. The "Configure Java Runtime" guide is just used to make the JDKs used by your project and the Java tooling itself more transparent.
The tool doesn't change your Java version, as the Java version of your project is provided by your build system. It simply allows you to change the mapping between Java version and the JDK used to compile and run your project. Also, it's tricky to let user to modify the build file directly from Java extension, we just provide some hints on how to modify it in build script.
When "Project JDKs" shows the JDK for your Java project version, it reads the values from java.configuration.runtimes.
@testforstephen I've 3 different JDK listed in java.configuration.runtimes.
Is it possible to set different JDK for different workspaces that are not managed by build tools?
What I found is that marking one runtime as 'default' lets it get picked up by VSCode, but I am looking for a per workspace setting.
@testforstephen I've 3 different JDK listed in java.configuration.runtimes. Is it possible to set different JDK for different workspaces that are not managed by build tools?
What I found is that marking one runtime as 'default' lets it get picked up by VSCode, but I am looking for a per workspace setting.
java.configuration.runtimes has machine scope, so it cannot be configured per-workspace. What if we were to introduce some setting : java.project.runtime that takes on one of the values from name property of java.configuration.runtimes. If detected, it'd override the default runtime specified there. This wouldn't expose the project to any of the runtime paths, but give it the ability to have a preferred runtime (if configured).
Hello,
This proposition will be very helpful. When one has several java projects not managed by build tools, requiring different versions of java (e.g. 1.8 versus 11), it is very annoying to have to change the default runtime each time one switch from one project to the other.
Also, this can provide a good solution to #1684 when not using the build tools.
Just adding some noise here to bump up the priority of the issue. It would be super useful to have this setting workspace-configurable! Seems like it should be a quick fix, I'd be happy to chip in a PR if someone could give a starting pointer.
Activity
rgrunber commentedon Jun 28, 2021
There's a few issues I see here :
java.configuration.runtimestestforstephen commentedon Jun 29, 2021
java.configuration.runtimes.java.configuration.runtimesare not listed there, it is a bug.anandbibek commentedon Jul 22, 2021
@testforstephen I've 3 different JDK listed in
java.configuration.runtimes.Is it possible to set different JDK for different workspaces that are not managed by build tools?
What I found is that marking one runtime as 'default' lets it get picked up by VSCode, but I am looking for a per workspace setting.
rgrunber commentedon Dec 7, 2021
java.configuration.runtimeshas machine scope, so it cannot be configured per-workspace. What if we were to introduce some setting :java.project.runtimethat takes on one of the values fromnameproperty ofjava.configuration.runtimes. If detected, it'd override thedefaultruntime specified there. This wouldn't expose the project to any of the runtime paths, but give it the ability to have a preferred runtime (if configured).selliera commentedon Feb 5, 2022
Hello,
This proposition will be very helpful. When one has several java projects not managed by build tools, requiring different versions of java (e.g. 1.8 versus 11), it is very annoying to have to change the default runtime each time one switch from one project to the other.
Also, this can provide a good solution to #1684 when not using the build tools.
A similar proposition was made for #1555 by @n-peugnet
thakkarparth007 commentedon Mar 2, 2022
Just adding some noise here to bump up the priority of the issue. It would be super useful to have this setting workspace-configurable! Seems like it should be a quick fix, I'd be happy to chip in a PR if someone could give a starting pointer.