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

Define several runtimes for a same version of Java #2115

Open
Nicryc opened this issue Sep 16, 2021 · 3 comments · May be fixed by eclipse-jdtls/eclipse.jdt.ls#3107
Open

Define several runtimes for a same version of Java #2115

Nicryc opened this issue Sep 16, 2021 · 3 comments · May be fixed by eclipse-jdtls/eclipse.jdt.ls#3107

Comments

@Nicryc
Copy link

Nicryc commented Sep 16, 2021

Is it possible to define several runtimes for a same version of Java in VSCode? I'd like to use the both the Hotspot and OpenJ9 JVM.

My java.configuration.runtimes setting in VSCode looks like this:

"java.configuration.runtimes": [
    {
        "name": "JavaSE-1.8",
        "path": "C:\\Program Files\\Eclipse Foundation\\jdk-8.0.302.8-hotspot"
    },
    {
        "name": "JavaSE-11",
        "path": "C:\\Program Files\\Eclipse Foundation\\jdk-11.0.12.7-hotspot"
    },
    {
        "name": "JavaSE-16",
        "path": "C:\\Program Files\\Eclipse Foundation\\jdk-16.0.2.7-hotspot"
    }
],

I also have other JVMs installed for each of these Java version on my machine. For example one of them is located here: C:\Program Files\Semeru\jdk-8.0.302.8-openj9.

Environment
  • Operating System: Windows 10
  • Visual Studio Code version: 1.60.0
  • Java extension version: 0.81.0
@rgrunber
Copy link
Member

rgrunber commented Sep 17, 2021

I don't think this is supported because the idea is to detect the target environment that the project requires (eg. Maven project defines source/target of 11) and use the corresponding JVM for that. If there were multiple, then we would need to prompt each time to clarify which is actually intended in that case.

I believe https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack provides a UI over java.configuration.runtimes that makes it a bit easier to modify these options. See #2001 (comment) for a rough idea.

@rgrunber
Copy link
Member

In #2001, we allowed projects to set their own java.configuration.runtimes . This allows having different runtimes for a particular Java version across projects. Not exactly what is requested here, but a step in that direction.

@jdneo
Copy link
Collaborator

jdneo commented Mar 13, 2024

Allowing multiple jdk installation paths for the same environment name in our setting schema can be helpful. Because we cannot guarantee that the jdk scan logic can always find all jdk installations. If java.configuration.runtimes allows configure multiple JDKs for the same environment. User can set those JDKs at global level then this information can be shared across all workspaces.

Why not just registering all user set JDKs to the registration? In the case that there are multiple JDKs maps to the same environment, it is not necessary to use the environment name as the JDK name, we can generate a unique name for it.

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

Successfully merging a pull request may close this issue.

4 participants