Setting up java dev env vscode with redhat.java

when setting up vscode with redhat.java extension in my shell.nix im getting server crash 5 times error unless i run code with sudo, any help?

Get the path to your JDK installation: readlink -f (which java) | cut -d '/' -f -4

then set the path to your jdk installation in either .vscode/setting.json or your global vscode config/preferences.

{
  "java.jdt.ls.java.home": "/nix/store/llwif7rw3hw8ajvkbvqigc8lg6agy51a-openjdk-19.0.2+7",
}

pointing to your OpenJDK installation.