Preview in plantuml-mode on macOS Emacs

I encountered 2 issues to preview in plantuml-mode on macOS Emacs. I resolved them but please tell me if you have better solution.

TL;DR

  • Upgrade your Java runtime to resolve CoreText warnings to stdout
  • Disable headless option
    • For plantuml-mode example
(setq plantuml-default-exec-mode 'jar)
(with-eval-after-load 'plantuml
  (setq plantuml-java-args
    (delete "-Djava.awt.headless=true" plantuml-java-args)))

Issues

  • There are 2 issues I encountered when using preview (C-c C-c) in plantuml-mode

Preview corruption

Cause
Solution
  • It has been resolved later version of Java runtime, so it can be solution to upgrade your Java environment
    • If you installed openjdk with brew, you can use brew upgrade openjdk
    • You have to consider because it may cause seemingly unrelated issue by upgrading your Java environment

headless exception

Information
Workaround
  • Disable passing -headless option to plantuml
    • plantuml-mode passes it to plantuml as default, so disable it
      • One of examples to disable it, put the codes at TL;DR into your Emacs configuration file
(setq plantuml-default-exec-mode 'jar)
(with-eval-after-load 'plantuml
  (setq plantuml-java-args
    (delete "-Djava.awt.headless=true" plantuml-java-args)))
  • If using via plantuml command, add -gui option
    • plantuml command automatically adds -Djava.awt.headless=true if -gui is not specified