Eglot does not trigger a custom formatter with jdtls, while lsp-java and VS Code with the Red Hat Java plugin can do this. See https://github.com/joaotavora/eglot/discussions/1222 for more background. I attach files * eglot-debug.el (the minimal configuration to see the failure) * NotHelloWorld.java (a sample Java file) * cay-eclipse-formatter.xml (the formatting rules for jdtls) * eglot-events.txt (the events log from eglot) * lsp-java-debug.el (the minimal configuration to see how it works with lsp-java) * lsp-log.txt (the log from the successful run with lsp) Download jdtls from https://download.eclipse.org/jdtls/snapshots/?d. I have the version from Oct. 14, 2023. Put it somewhere on your PATH Put the NotHelloWorld.java file in some directory (I use /tmp/hello) Put the cay-eclipse-formatter.xml file somewhere and adjust the path in eglot-debug.el and lsp-java-debug.el. emacs -q -l eglot-debug.el /tmp/hello/NotHelloWorld.java M-x eglot RET Wait for jdtls to start M-x eglot-format-buffer RET The formatting should now use the rules in the cay-eclipse-formatter.xml file, resulting in 8 changes but the same Allman indentation style. Instead, it uses a K&R indentation style. To see the proper formatting, install lsp-mode and lsp-java and start with lsp-java-debug.el. Or use VS Code with the Red Hat Java plugin and the settings.json { "java.format.settings.url": "file:///data/cay/bin/cay-eclipse.formatter.xml", "java.format.settings.profile": "cay" } In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-08-15 built on cay-ThinkPad-X1-Yoga-Gen-7 Windowing system distributor 'The X.Org Foundation', version 11.0.12101004 System Description: Ubuntu 22.04.3 LTS Configured using: 'configure --with-tree-sitter' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LC_MONETARY: de_DE.UTF-8 value of $LC_NUMERIC: en_US.UTF-8 value of $LC_TIME: en_DK.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=none locale-coding-system: utf-8-unix Major mode: Java//l Minor modes in effect: eglot-inlay-hints-mode: t eglot--managed-mode: t flymake-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t abbrev-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils files-x find-dired dired dired-loaddefs grep time-date cl-extra cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs eglot external-completion array filenotify jsonrpc ert pp ewoc debug backtrace help-mode find-func xref flymake-proc flymake thingatpt warnings icons compile text-property-search comint ansi-osc ansi-color ring pcase url-util url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map url-vars project byte-opt gv bytecomp byte-compile imenu cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 107858 9131) (symbols 48 11792 0) (strings 32 34568 1702) (string-bytes 1 1192636) (vectors 16 23157) (vector-slots 8 313544 12514) (floats 8 39 90) (intervals 56 661 0) (buffers 984 18))