Apache Commons Exec is a Java library that makes it easier to launch external processes from a Java application.
Questions tagged [apache-commons-exec]
87 questions
1
vote
2 answers
error trying to open cmd using apache commons-exec jar
I'm trying to do a mysql dump from apache commons-exec and i get the following error
Exception in thread "main" java.io.IOException: Cannot run program
"cmd.exe \c" (in directory "."): CreateProcess error=2, The system
cannot find the file…

user1
- 254
- 1
- 15
1
vote
1 answer
Apache Commons exec input problems
I am attempting to pass in some plain text keys to a third party external program, and then capture the output to a string. All seems to be working, except the third party program is not accepting the input as "normal". I get an "input too long"…

Neurobug
- 11
- 3
1
vote
0 answers
How to kill all of the sub-processes being created under my test suite?
I'm using maven (plugin version-1.7) and Aspectj-1.8.3.
My scenario is as follow: I have an installer jar that I want to test.
The installer is using another jar, my-common.jar library that wraps Apache's utility commons-exec-1.3 and use it to…

Modi
- 2,200
- 4
- 23
- 37
1
vote
4 answers
How to access file path with spaces from command prompt in Java
I am trying to run a batch file from a Java program.
For instance: I have a batch "abc.bat" in a folder in "Program Files".
I want to execute this batch from my Java Program. I am using CommandLine class, Commons-exec jar.
CommandLine cmdLine =…

user1395264
- 143
- 3
- 18
1
vote
1 answer
Why does "git pull" exec command get stuck and print nothing?
When executing the following command, I am prompted to type the password:
$ git pull
Enter passphrase for key (...)
When I try to show the same information programatically using Apache Commons Exec, the program gets stuck and doesn't print…

Fagner Brack
- 2,365
- 4
- 33
- 69
1
vote
1 answer
1
vote
0 answers
Trouble sending multiple values to an external process with apache commons-exec
I'm trying to write a little application that would automate the use of an external application which is cisco any connect mobility client. It provides a command line tools that you can use to connect to your VPN.
I want to run this command line…

Benoit Godard
- 11
- 1
1
vote
1 answer
Using Commons Exec for context-sensitive execution
What I'm trying to do is simply run a batch file that does some preparatory work necessary for the subsequent commands to be executed successfully (setting environment variables and stuff). To prove this I put together a sample that uses Commons…

Yasser Al Masri
- 53
- 1
- 10
1
vote
1 answer
Get and parse output stream from Apache exec commons
What I am trying to do is capture the stream of an IP Cam by using avconv. I have managed to get that stream and save it to a file using the apache exec commons library for Java like this:
DefaultExecuteResultHandler resultHandler = new…

Juan Ignacio Galan
- 55
- 10
1
vote
1 answer
Using apache exec on interactive command mode
What I need to do is enter interactive mode of an application, and then start sending commands to it. The application is graphicsmagick. batch mode puts you in a state similar to how mysql works, where you can then send commands without the name of…

Giannis
- 5,286
- 15
- 58
- 113
1
vote
2 answers
Getting process ID with java apache default executor
I'm writing a code that runs a commandline using default executor of apache.
I found the way to get the exit code but I couldn't found the way to get the process ID.
my code is:
protected void runCommandLine(OutputStream stdOutStream, OutputStream…

Rivi
- 791
- 3
- 15
- 23
1
vote
1 answer
Apache commons exec run pipe command fails
I would like Apache Commons-exec to run:
git status | head -n1 | cut -c13-
However seems it can not execute the command line and give error, Any ideas?
CommandLine cmdLine = CommandLine.parse( "git status | head -n1 | cut -c13-" );
DefaultExecutor…

Mike
- 3,515
- 10
- 44
- 67
1
vote
1 answer
Use apache commons-exec to run git clone: how to input password?
I try to use apache commons-exec to run git clone command but stuck, it did not prompt me with password input at all and block there.
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler( new PumpStreamHandler( System.out,…

Mike
- 3,515
- 10
- 44
- 67
1
vote
1 answer
Manually create SOAP Messages?
My goal is to set up a generic web service. By "generic" in this context I mean that, one should be able to run an arbitrary sequence of tools on the input (let's say a file).
These tools are compiled programms installed on the server.
My idea was…

nico1510
- 606
- 9
- 29
1
vote
0 answers
How to detect process time elapsed in Java excluding any time process has been sleeping
I am working on a Java program that launches a child process, receives data through stdout and performs some calculation and this process repeats. I run this program on a supercomputer that uses a Torque-related PBS with some special scheduling…

jason_r
- 33
- 6