12

I've created a java program to write a .dot file as I'm using Graphviz software to visualize some data. There is nothing wrong with a code itself, but when I try to execute the following command in command prompt:

dot -Tpdf data.dot -o data.pdf

in a folder where my java code is located, I get the following error:

'dot' is not recognized as an internal or external command, operable program or batch file.

Sorry if the question was asked before, but the only similar question I found related to this problem is this one, however, it doesn't seem quite clear to me how could it be helpful in this particular case.

Any help would be appreciated. Regards.

4 Answers 4

14

You have to add the directory (folder) where you installed Graphviz to your PATH environment variable. How to do that depends on which version of Windows you have, but for start you can look at this answer on SuperUser.

2
  • 7
    Thanks for the idea, executing the command "set path=%path%;C:\Program Files (x86)\Graphviz2.38\bin" in a folder where my code is located did the trick.
    – Bouhraoua
    Jan 13, 2018 at 20:00
  • 1
    @Bouhraoua Hi, Where should I run command, and how, please could share how you solved issue, because I am having same issue May 16, 2019 at 5:16
1

Be aware that Graphviz is a folder (container) which contains the "dot" executable. Therefore your modified PATH should lead to dot.py and not just the container Graphviz.

1

These days you could use chocolaty: choco install graphviz

That seems to add it to the path as part of the install

0

I had the same problem, and in my case I could not use any solution that required admin privileges (e.g., changing environment variables). So I downloaded the zip file from graphviz and just changed the working directory to the install directory temporarily to call dot or spell out the path to the dot command.

E.g.:

dot -Tpdf data.dot -o data.pdf  &REM Doesnt work
C:\pathTo\Graphviz\bin\dot -Tpdf data.dot -o data.pdf  &REM Works

Your Answer

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

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