I tried running my Spring boot project when I opened VS code then I saw this error. I have been using Java for some months now and this is the first time I am seeing this error.
My previous java projects have stopped running due to this error also.
Is there a possible fix to this?
Fixed. I was able to solve this error with the process below:
run java --version
in terminal to know your jdk versioncd /Library/Java/JavaVirtualMachines
/usr/libexec/java_home -V
echo 'export JAVA_HOME=/Library/Java/JavaVirtualMachines/your-java-17-version' >> ~/.bash_profile
source ~/.bash_profile
echo 'export JAVA_HOME=/Library/Java/JavaVirtualMachines/your-java-17-version' >> ~/.zshrc
source ~/.zshrc
echo $JAVA_HOME
Go to your project directory and run: mvn clean install
In VSCode, go to Command Palette > Clean Java Language Server Workspace