windows - Cross-platform way to run external process from java? -
i need call external program java such imagemagick's convert. fails work on windows unless put cmd /c before actual command.
string source = "test.jpg"; string result = "test-thumbnail.jpg"; processbuilder builder = new processbuilder().command("cmd", "/c", "convert", source, "-thumbnail", "295x", result); process process = builder.start(); how avoid using cmd /c code works on os other windows?
without cmd /c similar problem described here: running imagemagick convert (console application) python - there exists native windows convert.exe being called rather imagemagick's convert.exe. seems path not picked environment of child process.
i have double checked system path has imagemagick directory before c:\windows\system32. command runs fine when type windows command line.
you can check os.
private static string os = system.getproperty("os.name")
Comments
Post a Comment