I am using ImageMagick
on Mac OS X (10.7). I installed it with the help of MacPorts
.
When I now enter the Terminal and write:
identify image.jpg
it is working perfectly fine.
But now while executing it from within Java, the following exception gets thrown:
org.im4java.core.CommandException: java.io.FileNotFoundException: identify
I can see it's on the PATH
by running:
which identify
with the response:
/opt/local/bin/identify
Now while running:
echo $PATH
I get the response:
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
The same code works perfectly on Windows where ImageMagick
is also installed.
So why is im4java not finding identify
in the PATH
at all?
Try setting the search path to the target directory:
import org.im4java.process.ProcessStarter;
ProcessStarter.setGlobalSearchPath("/opt/local/bin");