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
2
votes
1 answer
Java Apache Commons Exec Watchdog and Windows cmd.exe issues
I am trying to use a watchdog for my program, but it does not work if I used cmd.exe to launching it. Watchdog kills the process if the process is started natively (without cmd.exe), but it does nothing if the program is started with cmd.exe.…

ToMmY_hun
- 77
- 11
2
votes
1 answer
ManagedExecutorService, ManagedTask and ManagedTaskListener alternative for Java SE
I recently built a Java EE 7 web application using GlassFish / Payara.
The web application started long running tasks (> 2 hours) on the underlying operating system on demand. These tasks are basically other programs or scripts written in Python,…

plasticfantastic
- 21
- 2
2
votes
1 answer
Java - apache commons exec, run 2 commands in same "context"
I am unsure if context is the right word to use here but what i mean is something like
cd .\test
test.exe
test.exe is located in the folder test and I want to run it from the folder test, I know I can run
.\test\test.exe
but I need test.exe to…

user3669539
- 139
- 1
- 9
2
votes
1 answer
Java IOException When Trying to Run a Bat File in Another Directory
I'm using Apache Commons Exec to run a bat file in my specified directory.
File file = new File("C:\\Users\\Aaron\\Documents\\MinecraftForge\\forge\\mcp");
for(String s : file.list())
{
if(s.equals("recompile.bat"))
{
…

Horotho
- 23
- 3
1
vote
1 answer
Process Object from Apache Commons Exec
I'm using the Apache Commons Exec jars for creating processes. However I'd like to get control of the process id of processes being invoked.
Is there a way of getting the 'Process' object from the Apache Commons Exec api? I did'nt fine any public…

Rajesh Kazhankodath
- 409
- 6
- 24
1
vote
2 answers
Getting all output data form console when running process with Apache Commons Exec
The thing is... I'm running a process with the DefaultExecutor class of org.apache.commons.exec libraries. Like this:
public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
CommandLine cmd = new…

Emiliano
- 185
- 1
- 12
1
vote
1 answer
While trying to run subprocess it prints only stdout then terminates
I'm using Apache Commons Exec and trying to start subprocess that would work for the entire duration of application. It should start process, accepttwo input commands and just stay in background. Now its only accepts one command (at least what…

mihn
- 801
- 1
- 11
- 22
1
vote
1 answer
Program hangs when trying to kill process, until eventually it is killed
I am working on fixing a bug that makes our CI/CD pipeline fails. During an integration test, we spin up a local database instance. In order to do this, we are using some mariadb wrappers to launch it from a java codebase.
This process can…

Anthony
- 189
- 1
- 15
1
vote
3 answers
Java Rsync Escape Spaces
I am trying to run rsync from a jar. When the source path has no spaces it all works fine, but when the source path has a space in it, it fails. I have tried various methods for escaping the spaces, as per the man pages, such as…

karen
- 893
- 2
- 13
- 38
1
vote
1 answer
How can I download a file from a site that is protected with a username and password, using the Selenium framework?
I am trying to download a file from a site that is protected with a username and password, using Selenium.
First, I got the href attribute from the download link:
WebElement downloadLinkElement = htmlElement.findElement(By.xpath());
…

Narcis Neacsu
- 1,013
- 2
- 12
- 19
1
vote
0 answers
Spawning separate windows for new processes with Apache Commons Exec?
I'm attempting to launch several batch files in their own windows using the Apache Commons Exec library, and although I'm able to launch them properly, I'm running into one small issue where the output from the JVMs being spawned are showing in the…

Darin Beaudreau
- 375
- 7
- 30
1
vote
1 answer
apache.commons.exec - swallow exception thrown by the executed process?
I use Apache's commons exec library to run another application from my java code on windows. That other application (tshark) might throw an ugly exception which makes windows pop up "an unhandled win32 exception occured in ..." window.
Is there…

r0u1i
- 3,526
- 6
- 28
- 36
1
vote
0 answers
Apache ExectuorWatchDog hangs while writing to System.out/JtextArea
I am executing testng.xml(having 40 Testcases) from cmd shell using Apache.commons.exec.Executor in java with following code :
public static void executeBatch(String folderLoc) throws Exception {
try {
String cmd_for_testng = "java…

Anu Chawla
- 415
- 1
- 4
- 19
1
vote
1 answer
app launched from java commons-exec can't access web on win7, but launched from cmd.exe can
Running on windows7, using wkhtmltopdf to generate a pdf from our site works fine from a command prompt. Running the exact same wkhtmltopdf command from a servlet running in jetty via commons-exec results in a blank pdf.
I've turned on the accesslog…

JJFeiler
- 61
- 1
- 4
1
vote
2 answers
Java does not execute all commands in shellscript with Apache commons exec
I'm getting such an strange behavior here.
I have the following method:
public static void loadMonitorsFromCron(){
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
File ism_dir = new File("/var/app/ism/");
String line…

vinicius.olifer
- 101
- 10