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

OpenJDK 16 in java.home not recognized #1969

Open
DisorderCloud opened this issue Jun 3, 2021 · 2 comments
Open

OpenJDK 16 in java.home not recognized #1969

DisorderCloud opened this issue Jun 3, 2021 · 2 comments
Labels

Comments

@DisorderCloud
Copy link

I installed openjdk 16.0.1 via homebrew, and set corresponding path in java.home, but under "Java Tooling Runtime" tab of "Configure Java Runtime" page, nothing is not listed. FYI, I also have another two jdk 8 installed, and both 3 are written to java.configuration.runtimes, but "Installed JDKs" tab only shows those two jdk 8 installation.

Environment
  • Operating System: macOS Big Sur 11.2.3 (on Apple Silicon)
  • JDK version: installed path says 16.0.1, but java -version says 17, brew info openjdk says it's 17 preview
  • Visual Studio Code version: 1.56.2 (Universal)
  • Java extension version:

Some lines from settings.json:

    "java.home": "/opt/homebrew/Cellar/openjdk/16.0.1",
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-16",
            "path": "/opt/homebrew/Cellar/openjdk/16.0.1",
        },
        {
            "name": "JavaSE-1.8",
            "path": "/Users/luzepu/Library/Java/JavaVirtualMachines/azul-1.8.0_292/Contents/Home",
            "default": true
        },
        {
            "name": "JavaSE-1.8",
            "path": "/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home"
        }
    ],

java -version outputs:

➜  ~ /opt/homebrew/Cellar/openjdk/16.0.1/bin/java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment Homebrew (build 17+0)
OpenJDK 64-Bit Server VM Homebrew (build 17+0, mixed mode)
➜  ~ /Users/luzepu/Library/Java/JavaVirtualMachines/azul-1.8.0_292/Contents/Home/bin/java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (Zulu 8.54.0.21-CA-macos-aarch64) (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (Zulu 8.54.0.21-CA-macos-aarch64) (build 25.292-b10, mixed mode)
➜  ~ /Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/bin/java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
@rgrunber
Copy link
Member

rgrunber commented Jun 4, 2021

The "Configure Java Runtime" view is coming from https://github.com/microsoft/vscode-java-pack , so my guess is this should be moved there. @testforstephen have you seen this issue before in that extension ?

@testforstephen
Copy link
Collaborator

I installed openjdk 16.0.1 via homebrew, and set corresponding path in java.home, but under "Java Tooling Runtime" tab of "Configure Java Runtime" page, nothing is not listed.

"Configure Java Runtime" page uses the same logic as vscode-java extension to find the Java home. Did you see any popups about invalid Java home?

Typically, the Java home in macOS ends with */Contents/Home. In your case, it looks like the java.home you configured is some symbolic link. Could you try "java.home": "/opt/homebrew/Cellar/openjdk/16.0.1/libexec/openjdk.jdk/Contents/Home" or /usr/local/Cellar/openjdk/16.0.1/libexec/openjdk.jdk/Contents/Home?

"Installed JDKs" tab only shows those two jdk 8 installation.

We just searches the JDK home from the common places. In macOS, it's /Library/Java/JavaVirtualMachines. The directory /opt/homebrew/Cellar is not scanned.

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

No branches or pull requests

3 participants