eclipse-jdtls / eclipse.jdt.ls

Java language server
1.79k stars 399 forks source link

Unable to import standard java classes #2628

Closed sumusjack closed 1 year ago

sumusjack commented 1 year ago

I might be missing something obvious here, but I am getting jdtls issues while just using standard java classes.

image image

Please let me know if I am missing something or what kinds of info is needed. I am newer to using neovim plugin. Thank you

sumusjack commented 1 year ago

Classes from maven dependencies and other parts of the project are imported fine

fbricon commented 1 year ago

please provide a sample project reproducing this issue

fbricon commented 1 year ago

Given classes from the JDK can't be resolved, it's possible you're targeting a JDK version that's not been configured in jdt.ls. You should configure the "java.configuration.runtimes" preference. See https://github.com/mfussenegger/nvim-jdtls/issues/44 for some examples

sumusjack commented 1 year ago

Thank you @fbricon I was able to add a Java path to my jdtls config and now it is picking up on standard java classes. Thanks! I will mark as closed.

For anyone else struggling with this:

image