On Wed, May 2, 2018 at 3:23 AM, Mark Trolley <marktrol...@gmail.com> wrote:

> (Sorry if this message appears twice. I sent it once before subscribing and
> haven't seen it appear in the archives so I assume it wasn't accepted.)
>
> I’m trying to use Apache Commons Exec to run the AtomicParsley tagging
> program, but execution fails with an error that the input file doesn’t
> exist. If I dump the command line arguments then manually execute
> AtomicParsley with the exact same arguments it succeeds. I know the file at
> the given path is readable because I tested reading it directly in my Java
> code and it succeeds. The error that the file doesn’t exist only happens
> when I use Commons Exec.
>
> Here is a snippet of my code:
>
> CommandLine cmdLine = new CommandLine("AtomicParsley");
> cmdLine.addArgument("${file}");
> cmdLine.addArgument("--overWrite");
> cmdLine.addArgument("--artwork");
> cmdLine.addArgument("REMOVE_ALL");
> Map<String, String> map = new HashMap<String, String>();
> map.put("file”, path.toFile().getAbsolutePath());
> cmdLine.setSubstitutionMap(map);
> ExecuteWatchdog watchdog = new ExecuteWatchdog(60 * 1000);
> Executor executor = new DefaultExecutor();
> executor.setExitValue(0);
> executor.setWatchdog(watchdog);
> try {
>     executor.execute(cmdLine);
> } catch (IOException ioe) {
>     System.err.println("Error removing artwork");
>     ioe.printStackTrace();
> }
>
> If I use a script to dump out the arguments I see they are correct:
>
> "/Users/mtrolley/testing_mp4/Futurama - S05E01.mp4"
> --overWrite
> --artwork
> REMOVE_ALL
>
> If I use those arguments to manually run AtomicParsley it works:
>
> $ AtomicParsley "/Users/mtrolley/testing_mp4/Futurama - S05E01.mp4”
> --overWrite --artwork REMOVE_ALL
> No changes.
> $
>
>
Apologize, I just wish to cover the basics.  Have you check which user you
use to execute the Java program?  And could you kindly check if that user
has the rights to execute AtomicParsley?  Maybe set file permission to 755
or something.



> When I run the same command using exec:
> AtomicParsley error: can't open "/Users/mtrolley/testing_mp4/Futurama -
> S05E01.mp4" for reading: No such file or directory
>
> Thanks in advance for any help.
>



-- 
Guang <http://javadevnotes.com/java-copy-array>

Reply via email to