Skip to content

Make it more easy to run different java version on different projects #1273

Open

Description

Is your feature request related to a problem? Please describe.
An error has occurred when i boot up my minecraft forge 1.12.x project:

[error] [gradle-server] Could not create an instance of Tooling API implementation using the specified Gradle distribution 'https://services.gradle.org/distributions/gradle-4.9-bin.zip'.

But i can still use ./gradlew to run gradle task without errors.
I've done a search for this error, and it says that this error cause by wrong JAVA_HOME setting.
And java command in my /usr/bin is JDK17, not JDK8 it need.
Before it, i've config .vscode/settings.json as this:

{
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-1.8",
            "path": "/usr/lib/jvm/java-8-openjdk-amd64",
            "default": true
        },
        {
            "name": "JavaSE-17",
            "path": "/usr/lib/jvm/java-17-openjdk-amd64"
        }
    ],
    "terminal.integrated.env.linux":{
        "JAVA_HOME": "/usr/lib/jvm/java-8-openjdk-amd64"
    }
}

This work will for run in java extension and terminal, but it look not work for gradle.

Describe the solution you'd like
Make java.import.gradle.java.home can be change in project's .vscode/settings.json, or provide other easy way to switch JAVA_HOME for gradle.

Describe alternatives you've considered
Don't use java.jdt.ls.java.home as default JAVA_HOME for gradle.
Instead, use java.configuration.runtimes to run gradle.

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

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions