1

The code below evaluated successfully but ~/Downloads/foo.png is empty. A look at the downloads folder shows that no file has been generated. What went wrong?

#+begin_src ditaa :file ~/Downloads/foo.png

    +--------+   +-------+    +-------+
    |        | --+ ditaa +--> |       |
    |  Text  |   +-------+    |diagram|
    |Document|   |!magic!|    |       |
    |     {d}|   |       |    |       |
    +---+----+   +-------+    +-------+
        :                         ^
        |       Lots of work      |
        +-------------------------+
#+end_src

#+results:
[[file:~/Downloads/foo.png]]

The same diagram, when ditaa is called from terminal, produces an output in 6 secs.

ditaa diagram.txt sample.png

ditaa version 0.11, Copyright (C) 2004--2017  Efstathios (Stathis) Sideris

Running with options:
Reading file: diagram.txt
Rendering to file: sample.png
Done in 6sec

ORG version

enter image description here

*Messages*

executing Ditaa code block...
java -Dfile.encoding=UTF-8 -jar /usr/local/bin/ditaa  /var/folders/rw/rpr418x91h13ysbc6k7fzj240000gn/T/babel-6iUieC/ditaa-lD3wxu /Users/satibodhi/Downloads/foo.png
Error: Invalid or corrupt jarfile /usr/local/bin/ditaa
Code block evaluation complete.

Seems like this has something to do with homebrew aliasing java -jar ditaa.jar to ditaa.

$ ditaa
usage: java -jar ditaa.jar <INPFILE> [OUTFILE] [-A] [-b <BACKGROUND>] [-d]
       [-E] [-e <ENCODING>] [-h] [--help] [-o] [-r] [-S] [-s <SCALE>]
       [--svg] [--svg-font-url <FONT>] [-T] [-t <TABS>] [-v] [-W]
8
  • FWIW, it works fine for me with Org mode version 9.2.3 (release_9.2.3-387-ga41e99). Edit the question and add the version of org-mode (M-x org-version will give you that information). Does your *Messages* buffer show anything suspicious?
    – NickD
    Commented Jun 21, 2019 at 2:51
  • 2
    You can customize org-ditaa-jar-path to point to the jar that is working. What does /usr/local/bin/ditaa look like?
    – NickD
    Commented Jun 21, 2019 at 13:10
  • It's a symlink to the ../Cellar path. $ ls -la ditaa lrwxr-xr-x 1 satibodhi admin 32 Jun 21 04:41 ditaa -> ../Cellar/ditaa/0.11.0/bin/ditaa. This is not a jar file either.
    – Sati
    Commented Jun 21, 2019 at 14:14
  • /var/folders/rw/rpr418x91h13ysbc6k7fzj240000gn/T/babel-6iUieC/ditaa-lD3wxu This portion of the executed code seems weird to me.
    – Sati
    Commented Jun 21, 2019 at 14:37
  • 1
    Of course there is, otherwise the alias would not work.
    – NickD
    Commented Jun 21, 2019 at 16:34

1 Answer 1

3

Solved:

Opening the above ditaa file in Emacs showed the following bash script:

#!/bin/bash
exec java  -jar /usr/local/Cellar/ditaa/0.11.0/libexec/ditaa-0.11.0-standalone.jar "$@"

The above code was evaluated successfully after setting org-ditaa-jar-path to /usr/local/Cellar/ditaa/0.11.0/libexec/ditaa-0.11.0-standalone.jar.

1
  • This saved me some debugging! Cheers! Commented Apr 14, 2020 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.