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

Setting up Java without java.home

Open charpov opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe.

The Gradle language server refuses to start on a project with the error message: There is no valid JAVA_HOME setting to launch Gradle Language Server. Please check your "java.home" setting. Setting java.home in JSON solves the issue, but triggers a warning from VS Code: This setting will be deprecated, please use the environment variable 'JAVA_HOME' instead.

Describe the solution you'd like

It'd be nice for the error message to suggest a non-deprecated solution. Also, how does one set a JAVA_HOME environment variable on macOS, notorious for its apps not picking up variables from the shell environment?

Additional context

VS Code version is 1.63.2.

Gradle for Java extension is 3.9.0.

charpov avatar Jan 13 '22 20:01 charpov

the current version of language support for Java (1.2.0) just use its own platform specific extension and deprecate java.home, that's the story. Let me just investigate a proper way to find a JVM to run the language server.

CsCherrYY avatar Jan 18 '22 01:01 CsCherrYY

the current version of language support for Java (1.2.0) just use its own platform specific extension and deprecate java.home, that's the story. Let me just investigate a proper way to find a JVM to run the language server.

java.jdt.ls.java.home seems to be the new standard which replaces the older java.home in VS Code. It would also be nice, if the plugin reads java.configuration.runtimes and picks the entry which has default set to true.

ravihara avatar Jan 30 '22 13:01 ravihara

I have added a pull-request - https://github.com/microsoft/vscode-gradle/pull/1169. Please check.

ravihara avatar Jan 30 '22 14:01 ravihara

@ravihara thanks for the pr, I'll take a look.

CsCherrYY avatar Feb 08 '22 02:02 CsCherrYY