Unable to create Java environment with VSCode

Asked 2 years ago, Updated 2 years ago, 100 views

I was building a Java environment in VSCode, but
in setting.json "java.home": "C:...java\openjdk-17.0.2" will also produce the following error:

This setting is detailed, please use 'java.jdt.ls.java.home' installed.

I'm a beginner, so please understand that many sentences may be strange.

environment:
Windows 10 Java 16.0.2

Enter a description of the image here

java vscode

2022-09-30 17:11

2 Answers

Translating the displayed message (with supplementary information) is as follows:

This setting (java.home) is deprecated.Use java.jdt.ls.java.home instead.

You may have set java.home on the page you modeled, but try setting PATH for java.jdt.ls.java.home as the message says.

Alternatively, if the environment variable JDK_HOME or JAVA_HOME is set, you may also refer to it.

Setting the JDK | Language support for Java™ for Visual Studio Code

The path to the Java Development Kit can be specified by the java.jdt.ls.java.home setting in VS Code settings (workspace/user settings).If not specified, it is searched in the following order until a JDK meetings current minimum requirement.

  • theJDK_HOMEenvironment variable
  • theJAVA_HOMEenvironment variable
  • on the current system path


2022-09-30 17:11

java\openjdk-17.0.2 appears, but you need to backslash twice on Windows.

example:

java\\openjdk-17.0.2


2022-09-30 17:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.