running shell file in Java code

I am running graphviz on a mac. I have a java class that makes .gv files and then also makes a shell file that creates .svg files from the .gv files so that I can open them in a web browser and see the tooltip labels that are added. The shell file then deletes the .gv files so I only have .svg files left. If I execute the shell file inside my java file the .gv files get deleted, but the .svg files aren't created. If i run the shell file through the terminal, it will then create the .svg files and delete the .gv files and everything works correctly.

Before I run the shell file, all the .gv files are created correctly. This is the commands in the shell file for each different .gv file:

dot -Tsvg -o file.svg file.gv
rm file.gv

Does anyone know why it will work correctly through the terminal but not from within my java program?

I'm not sure how you are

I'm not sure how you are invoking the script in java, but I'm guessing that the shell environment created by the java call has a minimal environment, so the dot program is not being found in the PATH. /bin is probably in the PATH so rm is found. That would explain why no svg is created, but the .gv files are removed. Try replacing dot with its full pathname.

If this doesn't work, please show the java code you are using to start the shell script.

Recent comments