Skip to content

Cygwin support #503

Description

@tomasjura

The cygwin directory system (and cygwin emacs) under windows is incompatible with java on windows. I did a small amendment in two functions:

(defun lsp-java--locate-server-config ()
  "Return the server config based on OS."
  (let ((config (cond
                 ((string-equal system-type "windows-nt") ; Microsoft Windows
                  "config_win")
                 ((string-equal system-type "cygwin") ; Microsoft Windows
                  "config_win")
                 ((string-equal system-type "darwin") ; Mac OS X
                  "config_mac")
                 (t "config_linux"))))
    (let ((inhibit-message t))
      (message (format "using config for %s" config)))
    (let ((c (expand-file-name config lsp-java-server-install-dir)))
      (if (equal system-type 'cygwin) (cygwin-convert-file-name-to-windows c) c))))

(defun lsp-java--locate-server-jar ()
  "Return the jar file location of the language server.
The entry point of the language server is in the `lsp-java-server-install-dir'
+ /plugins/org.eclipse.equinox.launcher_`version'.jar."
  (pcase (f-glob "org.eclipse.equinox.launcher_*.jar" (expand-file-name "plugins" lsp-java-server-install-dir))
    (`(,single-entry) (if (equal system-type 'cygwin) (cygwin-convert-file-name-to-windows single-entry) single-entry))
    (`nil nil)
    (server-jar-filenames
     (error "Unable to find single point of entry %s" server-jar-filenames))))

I'm not sure if these amendments are sufficient, because I still have some problems. But my existing problems have origin in lsp server itself 1 2, not the lsp-java.el package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions