Answer a question

My VSCode is no longer recognizing the paths of the java runtime. I was using them normally and now it doesn't work on the same projects anymore. Here are the error messages and my settings. The paths to the runtimes are correct.

Environment:

  • Operating System: Linux Mint 20 Cinnamon
  • JDK version: Openjdk version "11.0.8" 2020-07-14
  • Visual Studio Code version: v1.49.2
  • Java extension version: v0.68.0

Error:

Java Error Message

  • settings.json:
    "java.home": "/usr/lib/jvm/java-11-openjdk-amd64",
    "java.configuration.runtimes": [
    
      {
        "name": "JavaSE-1.8",
        "path": "/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java",
      },
      {
        "name": "JavaSE-11",
        "path": "/usr/lib/jvm/java-11-openjdk-amd64/bin/java",
        "default": true
      },
      {
        "name": "JavaSE-14",
        "path": "/usr/lib/jvm/java-14-openjdk-amd64/bin/java",
      },
    ],

Answers

The “path” parameter should be set to the location of the Java runtime directory, not to the java executable file. Take “/bin/java” off the end.

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐