graphviz – I have a problem creating a PNG image from Java using Grahviz's point command

Java will issue the following error when it reaches the line where it should generate the file. I use the following line of code to generate the image:

Runtime.getRuntime (). Exec ("dot -Tpng" + System.getProperty ("user.dir") + "\ Tree" + Correlated + ". Dot -o" + System.getProperty ("user.dir") + "\ Tree" + correlative + ". png");

However, I get the following error: Can not execute program "dot": CreateProcess error = 2, The system can not find the specified file
at java.lang.ProcessBuilder.start (unknown source)

Look for the error, but the answer I found was that I had to create an environment variable for Windows to detect the "dot" command. It's really the first time I've had this error with the Graphviz tool.