You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Siegfried Goeschl (JIRA)" <ji...@apache.org> on 2016/01/05 01:12:39 UTC
[jira] [Comment Edited] (EXEC-95) Program not found after
setWorkingDirectory
[ https://issues.apache.org/jira/browse/EXEC-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15082046#comment-15082046 ]
Siegfried Goeschl edited comment on EXEC-95 at 1/5/16 12:12 AM:
----------------------------------------------------------------
After some digging through the code
* the WinNTCommandLauncher is copied from a very old ANT source file
* WinNTCommandLauncher is actually never used (the same goes for OS2CommandLauncher)
So the problem is completely unrelated to "WinNTCommandLauncher"
I assume that
* "C:/user/script/" is not part of the PATH variable therefore the "myscript.cmd" was not found
* I'm not sure about Windows here - it seems that the script is not picked up from the current working directory
was (Author: sgoeschl):
After some digging through the code
* the WinNTCommandLauncher is copied from a very old ANT source file
* WinNTCommandLauncher is actually never used (the same goes for OS2CommandLauncher)
So the problem is completely unrelated to "WinNTCommandLauncher"
I assume that "C:/user/script/" is not part of the PATH variable therefore the "myscript.cmd" was not found
> Program not found after setWorkingDirectory
> -------------------------------------------
>
> Key: EXEC-95
> URL: https://issues.apache.org/jira/browse/EXEC-95
> Project: Commons Exec
> Issue Type: Bug
> Affects Versions: 1.3
> Environment: win7 64 bit.
> Reporter: Lorenzo Cozza
> Assignee: Siegfried Goeschl
>
> I would like to run my script from a different folder, so I tried to use the following line of code:
> String path = "C:/user/script/";
> CommandLine cmdLine = CommandLine.parse("myscript.cmd");
> DefaultExecutor executor = new DefaultExecutor();
> executor.setWorkingDirectory(new File(path));
> int exitValue = executor.execute(cmdLine);
> but I got an exception.
> I am using the following workaround:
> CommandLine cmdLine = CommandLine.parse(path+"/myscript.cmd");
> and it's working fine.
> The question is: are Executor and CommandLine related?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)