I'm using lsp-java package as java IDE and syntax completion.

Below is my configuration

    (require 'lsp-java)
    (add-hook 'java-mode-hook #'lsp)

    (condition-case nil
        (require 'use-package)
       (require 'package)
       (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
       (package-install 'use-package)
       (setq use-package-always-ensure t)
       (require 'use-package)))

    (use-package projectile)
    (use-package flycheck)
    (use-package yasnippet :config (yas-global-mode))
    (use-package lsp-mode :hook ((lsp-mode . lsp-enable-which-key-integration))
      :config (setq lsp-completion-enable-additional-text-edit nil))
    (use-package hydra)
    (use-package company)
    (use-package lsp-ui)
    (use-package which-key :config (which-key-mode))
    (use-package lsp-java :config (add-hook 'java-mode-hook 'lsp))
    (use-package dap-mode :after lsp-mode :config (dap-auto-configure-mode))
    (use-package dap-java :ensure nil)
    (use-package helm-lsp)
    (use-package helm
      :config (helm-mode))
    (use-package lsp-treemacs)

When I open any java file, I get the error file mode specification error (wrong-type-argument lsp--client nil)

enter image description here

This error seems to happen when I deleted the packages and reinstalled the packages. particularly lsp-java.

Any idea how can I resolve this error?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.