I have a grade project (7.6) that is also a LibGDX project and the latest java jdk (19.0.1) installed. I am on Mac OS Monterey btw.
The problem is that when opening the gradle project inside VSCode it throws a lot of errors.
It is however possible to run the program using the gradle run
command.
Here are some examples of the errors that it throws:
Method references are allowed only at source level 1.8 or above
Syntax error on token "record", @ expected
Syntax error on token "double", { expected
Syntax error on tokens, ClassHeader expected instead
Syntax error on tokens, ClassInstanceCreationExpressionName expected instead
Here are the things that I have already tried to fix it:
- Set the
JAVA_HOME
variable to/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home
- Set
java.jdt.ls.java.home
to/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home
in the user and workspace section of the VSCode settings - Switch the "Language Support for Java(TM) by Red Hat" VSCode extension to the pre-release version
- Clean and reload the Java Language Server Workspace
Unfortunately without any success. At this point I'm clueless as to what else to try because it does work without problems with gradle, it's just inside VSCode that it shows all these errors.
Thank you very much in advance!