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

Extension version 1.22.0 cannot find OpenJDK on macOS #3287

Closed
plastr opened this issue Sep 12, 2023 · 25 comments
Closed

Extension version 1.22.0 cannot find OpenJDK on macOS #3287

plastr opened this issue Sep 12, 2023 · 25 comments

Comments

@plastr
Copy link

plastr commented Sep 12, 2023

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:

The project was not built since its build path is incomplete.
Cannot find the class file for java.lang.Object.

This is resolved by downgrading to version 1.21.0 of the extension.

Environment
  • Operating System: macOS 13.5 (Apple Silicon)
  • JDK version: OpenJDK Temurin-17.0.8.1+1
  • Visual Studio Code version: 1.82.1
  • Java extension version: 1.22.0
Steps To Reproduce
  1. Reproduced inside a new macOS 13 install running in a virtual machine.
  2. Install VSCode 1.82.1
  3. Install Extension Pack for Java (Includes current 'Language Support for Java by Red Hat', version 1.22.0)
  4. Install VSCode suggested JVM (OpenJDK Temurin-17.0.8.1+1)
  5. Create a HelloWorld.java file
  6. Various compiler errors shown in VSCode.
  7. Downgrade 'Language Support for Java by Red Hat' plugin from 1.22.0 to 1.21.0
  8. Reload VSCode
  9. HelloWorld.java code now compiles and runs.

[Please attach a sample project reproducing the error]

public class HelloWorld {
    public static void main(String[] args) throws Exception {
        System.out.println("Hello, World!"); 
    }
}
@plastr plastr changed the title Extension version 1.22.0 cannot find OpenJDK JDK on macOS Extension version 1.22.0 cannot find OpenJDK on macOS Sep 12, 2023
@pgraug
Copy link

pgraug commented Sep 13, 2023

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

@Soohti
Copy link

Soohti commented Sep 13, 2023

Same issue here

@jdneo
Copy link
Collaborator

jdneo commented Sep 13, 2023

Hi,

Could you run the command View: Focus on Java Projects View and take a screenshot of that explorer?

@Pfeil
Copy link

Pfeil commented Sep 13, 2023

Same issue for me. It first complained about the gradle deamons not fitting the expectations (it expected java home to be /usr).

[{
	"resource": "/Users/pfeil/git/pit-service",
	"owner": "_generated_diagnostic_collection_name_#5",
	"code": "0",
	"severity": 8,
	"message": "Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-8.1.1-bin.zip'.\nThe newly created daemon process has a different context than expected.\nIt won't be possible to reconnect to this daemon. Context mismatch: \nJava home is different.\nWanted: DefaultDaemonContext[uid=null,javaHome=/usr,daemonRegistryDir=/Users/pfeil/.gradle/daemon,pid=3942,idleTimeout=null,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=384m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=utf8,-Duser.country=DE,-Duser.language=de,-Duser.variant]\nActual: DefaultDaemonContext[uid=2043f326-eb92-46ef-96cb-666b76a73499,javaHome=/usr/local/Cellar/openjdk@17/17.0.8.1/libexec/openjdk.jdk/Contents/Home,daemonRegistryDir=/Users/pfeil/.gradle/daemon,pid=3984,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=384m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=utf8,-Duser.country=DE,-Duser.language=de,-Duser.variant]",
	"source": "Java",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 1
}]

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
openJDK 17.0.8.1
VS Code 1.82.1

Could you run the command View: Focus on Java Projects View and take a screenshot of that explorer?

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: /usr/, even though I used the settings to fix the path to /Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home. I assume this is an issue. The entry does not have any children. Before the issue, I did not have to set any path in the settings, btw.

@testforstephen
Copy link
Collaborator

The "JRE System Library [JavaSE-17]" gives when I to right-click and copy path: /usr/

The copy JDK path /usr/ looks wrong.

Did you see any errors in the logs?
F1 -> Java: Open Java Language Server Log File

@Pfeil
Copy link

Pfeil commented Sep 13, 2023

Hm, yes, some excerpts (the second snippet says something about /usr being set shortly after an error):

First snippet (version 1.21)

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:28:51.168
!MESSAGE Shutdown received... waking up main thread

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:28:51.175
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is stopping:
!SESSION 2023-09-13 13:29:33.976 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.8.1
java.vendor=Homebrew
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=de_DE
Command-line arguments:  -data /Users/pfeil/Library/Application Support/Code/User/workspaceStorage/a73f9fdfc43eb1a91814461df805c8b9/redhat.java/jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:35.809
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:36.028
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:36.070
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:36.072
!MESSAGE Initializing Java Language Server 1.26.0.202307271244

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:36.073
!MESSAGE Started org.eclipse.m2e.core 1ms

!ENTRY org.eclipse.core.jobs 4 2 2023-09-13 13:29:36.077
!MESSAGE An internal error occurred during: "Look up for installed JVMs".
!STACK 0
java.lang.UnsupportedOperationException: remove
	at java.base/java.util.Iterator.remove(Iterator.java:102)
	at java.base/java.util.Collection.removeIf(Collection.java:577)
	at org.eclipse.jdt.internal.launching.DetectVMInstallationsJob.run(DetectVMInstallationsJob.java:66)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:37.029
!MESSAGE ProjectRegistryRefreshJob finished 955ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:37.193
!MESSAGE Started org.eclipse.buildship.core 164ms

Second snippet (version 1.22)

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:10.676
!MESSAGE Shutdown received... waking up main thread

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:10.683
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is stopping:
!SESSION 2023-09-13 13:30:13.912 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.8.1
java.vendor=Homebrew
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=de_DE
Command-line arguments:  -data /Users/pfeil/Library/Application Support/Code/User/workspaceStorage/a73f9fdfc43eb1a91814461df805c8b9/redhat.java/jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:15.970
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:16.250
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:16.302
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:16.304
!MESSAGE Initializing Java Language Server 1.27.0.202309120354

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:16.304
!MESSAGE Started org.eclipse.m2e.core 0ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:17.688
!MESSAGE ProjectRegistryRefreshJob finished 1383ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:17.942
!MESSAGE Started org.eclipse.buildship.core 252ms

...

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:18.979
!MESSAGE Importing Gradle project(s)

!ENTRY org.eclipse.jdt.ls.core 4 0 2023-09-13 13:30:19.504
!MESSAGE Cannot download Gradle sha256 checksum: https://services.gradle.org/distributions-snapshots/gradle-8.5-20230912221653+0000-wrapper.jar.sha256
!STACK 0
java.io.FileNotFoundException: https://downloads.gradle.org/distributions-snapshots/gradle-8.5-20230912221653+0000-wrapper.jar.sha256
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1996)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
	at org.eclipse.jdt.ls.internal.gradle.checksums.DownloadChecksumJob.run(DownloadChecksumJob.java:77)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:20.828
!MESSAGE Workspace initialized in 2796ms

!ENTRY org.springframework.tooling.jdt.ls.extension 1 0 2023-09-13 13:30:20.849
!MESSAGE Boot project ADDED: TypedPIDMaker

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:20.849
!MESSAGE >> initialization job finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:20.853
!MESSAGE >> registerWatchers'

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:20.856
!MESSAGE >> registerFeature 'workspace/didChangeWatchedFiles'

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:20.861
!MESSAGE Setting /usr/local/Cellar/openjdk/20.0.2/libexec/openjdk.jdk/Contents/Home as 'JavaSE-20' environment (id:1694604620857)

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:20.863
!MESSAGE Setting /usr/local/Cellar/openjdk@11/11.0.20.1/libexec/openjdk.jdk/Contents/Home as 'JavaSE-11' environment (id:1694604620862)

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:21.520
!MESSAGE Setting /usr as 'JavaSE-17' environment (id:1694604620864)

!ENTRY org.springframework.tooling.jdt.ls.extension 1 0 2023-09-13 13:30:22.126
!MESSAGE Classpath changed for project: TypedPIDMaker

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:22.202
!MESSAGE JVM Runtimes changed, saving new configuration

!ENTRY org.springframework.tooling.jdt.ls.extension 1 0 2023-09-13 13:30:22.254
!MESSAGE ClasspathListenerHandler executeCommand sts.java.addClasspathListener, [f08adf9d-1d42-4012-86cc-5d65f9c47a85]

!ENTRY org.springframework.tooling.jdt.ls.extension 1 0 2023-09-13 13:30:22.255
!MESSAGE ClasspathListenerHandler addClasspathListener f08adf9d-1d42-4012-86cc-5d65f9c47a85

!ENTRY org.springframework.tooling.jdt.ls.extension 1 0 2023-09-13 13:30:22.259
!MESSAGE ClasspathListenerHandler addClasspathListener f08adf9d-1d42-4012-86cc-5d65f9c47a85 => OK

!ENTRY java-debug 1 0 2023-09-13 13:30:23.114
!MESSAGE Starting com.microsoft.java.debug.plugin

!ENTRY org.eclipse.jdt.ls.core 4 0 2023-09-13 13:30:25.883
!MESSAGE Error occured while building workspace. Details: 
 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; code: 0; resource: /Users/pfeil/git/pit-service;
 message: The type java.lang.Throwable cannot be resolved. It is indirectly referenced from required type com.fasterxml.jackson.databind.JsonMappingException; code: 16777563; resource: /Users/pfeil/git/pit-service/src/test/java/edu/kit/datamanager/pit/web/TabulatorPaginationFormatTest.java;

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:25.893
!MESSAGE >> build jobs finished

!ENTRY org.springframework.tooling.jdt.ls.extension 1 0 2023-09-13 13:30:26.227
!MESSAGE ClasspathListenerHandler executeCommand sts.java.addClasspathListener, [sts4.classpath.kyPZxrEk]

!ENTRY org.springframework.tooling.jdt.ls.extension 1 0 2023-09-13 13:30:26.228
!MESSAGE ClasspathListenerHandler addClasspathListener sts4.classpath.kyPZxrEk

!ENTRY org.springframework.tooling.jdt.ls.extension 1 0 2023-09-13 13:30:26.228
!MESSAGE ClasspathListenerHandler addClasspathListener sts4.classpath.kyPZxrEk => OK

@testforstephen
Copy link
Collaborator

@Pfeil Thanks for the information, it's very helpful.

Looks like Java extension detects /usr as 'JavaSE-17' home path, this should be a bug. Since the underlying library we used for JDK detection is https://github.com/Eskibear/node-jdk-utils, can you help me confirm if it detects a wrong JDK java home?

If you have nodejs installed in your machine, you can run the command npm i jdk-utils && npx jdk-utils to list the installed jdks by node-jdk-utils. thanks.

@Pfeil
Copy link

Pfeil commented Sep 13, 2023

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 }
  }
]

@fbricon
Copy link
Collaborator

fbricon commented Sep 13, 2023

Hm, yes, some excerpts (the second snippet says something about /usr being set shortly after an error):

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:28:51.168
!MESSAGE Shutdown received... waking up main thread

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:28:51.175
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is stopping:
!SESSION 2023-09-13 13:29:33.976 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.8.1
java.vendor=Homebrew
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=de_DE
Command-line arguments:  -data /Users/pfeil/Library/Application Support/Code/User/workspaceStorage/a73f9fdfc43eb1a91814461df805c8b9/redhat.java/jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:35.809
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:36.028
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:36.070
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:36.072
!MESSAGE Initializing Java Language Server 1.26.0.202307271244

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:36.073
!MESSAGE Started org.eclipse.m2e.core 1ms

!ENTRY org.eclipse.core.jobs 4 2 2023-09-13 13:29:36.077
!MESSAGE An internal error occurred during: "Look up for installed JVMs".
!STACK 0
java.lang.UnsupportedOperationException: remove
	at java.base/java.util.Iterator.remove(Iterator.java:102)
	at java.base/java.util.Collection.removeIf(Collection.java:577)
	at org.eclipse.jdt.internal.launching.DetectVMInstallationsJob.run(DetectVMInstallationsJob.java:66)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:37.029
!MESSAGE ProjectRegistryRefreshJob finished 955ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:37.193
!MESSAGE Started org.eclipse.buildship.core 164ms

@testforstephen this suggests :

@Pfeil
Copy link

Pfeil commented Sep 13, 2023

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.

@rgrunber rgrunber added this to the End September 2023 milestone Sep 13, 2023
@fbricon
Copy link
Collaborator

fbricon commented Sep 13, 2023

@Pfeil this bit of the log

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:29:36.072
!MESSAGE Initializing Java Language Server 1.26.0.202307271244

indicates you were running vscode-java 1.21 at that 13:29

@Pfeil
Copy link

Pfeil commented Sep 13, 2023

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.

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-09-13 13:30:16.304
!MESSAGE Initializing Java Language Server 1.27.0.202309120354

@rgrunber
Copy link
Member

rgrunber commented Sep 13, 2023

There's a new pre-release in the VS Code & OpenVSX marketplaces for a 1.23.2023091313 pre-release. Could those affected (@Pfeil , @pgraug , @plastr ) try it out and let us know whether that fixes this issue ?

If you don't want to go through the pre-release UI in VS Code, assuming you're either on darwin-x64 or darwin-arm64, VS Code Marketplace provides a direct link to the vsix through the "Version History" tab :

image

Alternate links :

@plastr
Copy link
Author

plastr commented Sep 13, 2023

Version 1.23.2023091313 of the extension resolves the issue for me. Thank you!

@berriesaregreat
Copy link

berriesaregreat commented Sep 13, 2023

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!

@js-seth-h
Copy link

Hi.
Same Here. Mac M2, Ventura 13.5.2, Vscode 1.82.1 , amazon-corretto-17.jdk.
downgrading to 1.21 resolved all issues, me too.

➜ ~ npm i jdk-utils && npx jdk-utils

up to date, audited 2 packages in 357ms

found 0 vulnerabilities
Listing JDKs: 41.111ms
Found: 2
[
{
homedir: '/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home',
hasJavac: true,
version: { java_version: '17.0.8.1', major: 17 }
},
{
homedir: '/usr',
isInPathEnv: true,
hasJavac: true,
version: { java_version: '17.0.8.1', major: 17 }
}
]

@rgrunber
Copy link
Member

rgrunber commented Sep 13, 2023

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!

@berriesaregreat We moved a lot of snippets (like sout) to the server side so the language server would only activate them where it made sense. How are you using sout ? One of the differences is that it will no longer show up unless you are within a statement block. So it wouldn't show up if you're just within a type declaration.

@berriesaregreat
Copy link

berriesaregreat commented Sep 13, 2023

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!

@berriesaregreat We moved a lot of snippets (like sout) to the server side so the language server would only activate them where it made sense. How are you using sout ? One of the differences is that it will no longer show up unless you are within a statement block. So it wouldn't show up if you're just within a type declaration.

You are correct - I was not within a statement block. It works fine on 1.23 :)

@jdneo
Copy link
Collaborator

jdneo commented Sep 14, 2023

I found a way to reproduce the issue yesterday, and tried v1.23.2023091313 today, the issue is fixed now.

@eungook
Copy link

eungook commented Sep 14, 2023

@rgrunber it works to me. thank you for helping us

@starball5
Copy link

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.

@0xcD3v
Copy link

0xcD3v commented Sep 14, 2023

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
Listing JDKs: 16.962ms
Found: 3
[
{
homedir: '/opt/homebrew/Cellar/openjdk@17/17.0.8.1/libexec/openjdk.jdk/Contents/Home',
isJavaHomeEnv: true,
isInPathEnv: true,
hasJavac: true,
version: { java_version: '17.0.8.1', major: 17 }
},
{
homedir: '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home',
hasJavac: true,
version: { java_version: '11.0.20', major: 11 }
},
{
homedir: '/opt/homebrew/Cellar/openjdk/20.0.2/libexec/openjdk.jdk/Contents/Home',
hasJavac: true,
version: { java_version: '20.0.2', major: 20 }
}
]

update: version 1.21.0 works.

@fbricon
Copy link
Collaborator

fbricon commented Sep 14, 2023

We've released 1.22.1, fixing this issue, to the marketplace. Please make sure you update.
If you still see JDK class errors after upgrading to 1.22.1, please open Command Palette and run "Java: Clean Java Language Server Workspace".

@fbricon fbricon closed this as completed Sep 14, 2023
@starball5
Copy link

@fbricon thanks! I updated my answer on Stack Overflow with the info you just gave :)

@Veyg
Copy link

Veyg commented Sep 14, 2023

We've released 1.22.1, fixing this issue, to the marketplace. Please make sure you update.
If you still see JDK class errors after upgrading to 1.22.1, please open Command Palette and run "Java: Clean Java Language Server Workspace".

It does fix the issue. Cleaning workspace is a must

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

No branches or pull requests