-
Notifications
You must be signed in to change notification settings - Fork 440
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
Extension version 1.22.0 cannot find OpenJDK on macOS #3287
Comments
Version 1.22.0 also broke Java in VS Code for me on macOS 13.3.1 (Apple Silicon) with VS Code v1.82.1 and OpenJDK Runtime Environment Zulu17.44+53-CA Downgrading the extension to v1.21.0 as @plastr mentioned also fixes the issue for me |
Same issue here |
Hi, Could you run the command |
Same issue for me. It first complained about the gradle deamons not fitting the expectations (it expected java home to be /usr).
Then I provided the path to expect in the settings and then I got to the point described here. It seemed to be very inconsistent, though. Cleaning the workspace may resulted in java.lang.Object not being found or others like Throwable. But in every case it was something from the standard library. Copied message: [{
"resource": "/Users/pfeil/git/pit-service",
"owner": "_generated_diagnostic_collection_name_#2",
"code": "0",
"severity": 8,
"message": "The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Throwable. Fix the build path then try building this project",
"source": "Java",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1
}] Downgrading and cleaning the language server workspace helped. It worked fine last week and the only things which changed on this machine are the patch of vs code (1.28.1) and the updates of the Java plugins. macOS Ventura 13.5.2
Anything in there which is especially interesting for you? It basically marks all files in red (with errors) which are opened. No matter if they are tests or actual code. The "JRE System Library [JavaSE-17]" gives when I to right-click and copy path: |
The copy JDK path Did you see any errors in the logs? |
Hm, yes, some excerpts (the second snippet says something about /usr being set shortly after an error): First snippet (version 1.21)
Second snippet (version 1.22)
|
@Pfeil Thanks for the information, it's very helpful. Looks like Java extension detects If you have nodejs installed in your machine, you can run the command |
Confirmed: > npm i jdk-utils && npx jdk-utils
added 1 package, and audited 2 packages in 1s
found 0 vulnerabilities
Listing JDKs: 76.725ms
Found: 4 [
{
homedir: '/usr/local/Cellar/openjdk@17/17.0.8.1/libexec/openjdk.jdk/Contents/Home',
hasJavac: true,
version: { java_version: '17.0.8.1', major: 17 }
},
{
homedir: '/usr/local/Cellar/openjdk@11/11.0.20.1/libexec/openjdk.jdk/Contents/Home',
hasJavac: true,
version: { java_version: '11.0.20.1', major: 11 }
},
{
homedir: '/usr/local/Cellar/openjdk/20.0.2/libexec/openjdk.jdk/Contents/Home',
hasJavac: true,
version: { java_version: '20.0.2', major: 20 }
},
{
homedir: '/usr',
isInPathEnv: true,
hasJavac: true,
version: { java_version: '17.0.8.1', major: 17 }
}
] |
@testforstephen this suggests :
|
I am not sure this first snippet contains logs from the old version. I have been switching a lot. Should have double-checked, sorry. I'd suggest including the version number of the plugin into the logs. |
@Pfeil this bit of the log
indicates you were running vscode-java 1.21 at that 13:29 |
Ah yes, sorry. So from what I get is that the second snippet is from 1.22 then (see log below). Sorry for the confusion. So I guess the first one can be ignored. In any case, I think we found the issue here, as the npm command has this issue, independent of vscode.
|
There's a new pre-release in the VS Code & OpenVSX marketplaces for a If you don't want to go through the pre-release UI in VS Code, assuming you're either on Alternate links : |
Version 1.23.2023091313 of the extension resolves the issue for me. Thank you! |
Chiming in late, but downgrading to 1.21 resolved all issues for me; going to 1.23.2023091313 fixed it too but it also broke shortcuts such as sout (the prompt to expand it to system.out doesn't show up). Thanks! |
Hi. ➜ ~ npm i jdk-utils && npx jdk-utils up to date, audited 2 packages in 357ms found 0 vulnerabilities |
@berriesaregreat We moved a lot of snippets (like |
You are correct - I was not within a statement block. It works fine on 1.23 :) |
I found a way to reproduce the issue yesterday, and tried |
@rgrunber it works to me. thank you for helping us |
Related on Stack Overflow: Why is my build path suddenly incomplete for my java project in VS Code?, where I have written up an answer post. |
Hey guys i have this problem even in the latest release version. "The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Exception. Fix the build path then try building this project." I already tried to set up $JAVA_HOME = /opt/homebrew/opt/openjdk@17/ in .zshrc, downgrading to version 1.22.2023090704, setting the java path in settings.json and i can't solve this problem. I have M1 chip my macOS version is 13.5.2, my vs code version is 1.82.1 npm i jdk-utils && npx jdk-utils : added 1 package in 2s update: version 1.21.0 works. |
We've released 1.22.1, fixing this issue, to the marketplace. Please make sure you update. |
@fbricon thanks! I updated my answer on Stack Overflow with the info you just gave :) |
It does fix the issue. Cleaning workspace is a must |
Compiling or running Java code using version 1.22.0 of the extension on macOS 13.5 (Apple Silicon) using VSCode 1.82.1 and OpenJDK Temurin-17.0.8.1+1 results in errors, including the following, suggesting that the JDK cannot be found:
This is resolved by downgrading to version 1.21.0 of the extension.
Environment
Steps To Reproduce
[Please attach a sample project reproducing the error]
The text was updated successfully, but these errors were encountered: