Configuring JDTLS #1042
-
Hi, However, if i change the -data parameter I get "class cannot be resolved to a type", even though the class's implementation is in the same folder. Googling I saw another issue like this, maybe using What can I do? I'm using the last |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Here is what works for me: (defun java-eclipse-jdt-launcher (_arg)
"Returns a command to start Eclipse JDT launcher script `jdtls'."
(let ((launcher-script (expand-file-name "org.eclipse.jdt.ls.product/target/repository/bin/jdtls" "~/code/eclipse.jdt.ls/"))
(root-directory (project-root (project-current))))
(if (file-exists-p launcher-script)
(list launcher-script
"-data"
(expand-file-name (format "%s-%s" (md5 root-directory)
(file-name-base (directory-file-name root-directory )))
"~/code/jdt-workspace/"))
(message "Failed to find any JDT jar files.")
nil)))
(add-to-list 'eglot-server-programs `(java-mode . ,#'java-eclipse-jdt-launcher)) I use a separate directory for each project as the jdtls data directory for the project. ^ You should change "~/code/jdt-workspace/" to a directory that you would like to use as the workspace directory and it should be outside all of the projects that you plan to use |
Beta Was this translation helpful? Give feedback.
Here is what works for me: