runtime.exec Questions

3

Solved

I am executing a command which returns me the Revision number of a file; 'fileName'. But if there is some problem executing the command, then the application hangs up. What can I do to avoid that c...
Indetermination asked 22/10, 2012 at 9:34

13

Solved

In my Java application, I want to run a batch file that calls "scons -Q implicit-deps-changed build\file_load_type export\file_load_type" It seems that I can't even get my batch file to execute. I...
Sisk asked 5/3, 2009 at 18:24

3

I am trying to run ffmpeg via the exec call on linux. However I have to use quotes in the command (ffmpeg requires it). I've been looking through the java doc for processbuilder and exec and questi...
Liverish asked 6/7, 2010 at 20:59

7

I am creating a process P1 by using Process P1= Runtime.exec(...). My process P1 is creating another process say P2, P3.... Then I want to kill process P1 and all the processes created by P1 i.e. P...
Methadone asked 4/5, 2011 at 7:11

10

I want to create diff of two files. I tried searching for code in Java that does it, but didnt find any simple code/ utility code for this. Hence, I thought if I can somehow run linux diff/sdiff co...
Alonzo asked 4/8, 2010 at 6:50

5

Solved

I tried to make an application that calls an external program that I have to pass two parameters. It doesn't give any errors. The program.exe, written in C++, takes a picture and modifies the conte...
Worthy asked 21/12, 2012 at 13:23

4

Solved

How am I to execute a command in Java with parameters? I've tried Process p = Runtime.getRuntime().exec(new String[]{"php","/var/www/script.php -m 2"}); which doesn't work. String[] options = ...
Orlandoorlanta asked 20/8, 2011 at 20:27

8

I have the following class. It allows me to execute commands through java. public class ExecuteShellCommand { public String executeCommand(String command) { StringBuffer output = new StringBuff...
Banas asked 9/11, 2014 at 16:51

12

Solved

Process process = Runtime.getRuntime().exec("tasklist"); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); process.waitFor();
Vermination asked 30/3, 2011 at 8:26

5

Solved

What's the best way to kill a process in Java ? Get the PID and then killing it with Runtime.exec() ? Use destroyForcibly() ? What's the difference between these two methods, and is there any o...
Sulemasulf asked 5/2, 2016 at 17:54

2

Solved

I have an application, running on the Playframework, which needs to encode some video files. I used Process pr = Runtime.getRuntime().exec(execCode) for this (and it works perfectly), but as I ...
Tomato asked 24/5, 2012 at 10:12

8

Solved

I've created a standalone java application in which I'm trying to change the directory using the "cd" command in Ubuntu 10.04 terminal. I've used the following code. String[] command = new String[...
Basilisk asked 3/2, 2011 at 10:2

3

Solved

I am trying to start the CMD application in windows by using the following code, but it doesn't work as expected. Several examples from different websites shows that "cmd" as an argument in the Pro...
Septavalent asked 8/6, 2012 at 18:28

7

NOTE: Coming back to this later as I've been unable to find a working solution. Draining the input streams manually instead of using BufferedReaders doesn't seem to help as the inputStream.read() m...
Electromyography asked 6/12, 2010 at 13:57

4

Solved

Consider the following code: String commandf = "ls /etc | grep release"; try { // Execute the command and wait for it to complete Process child = Runtime.getRuntime().exec(commandf); child.wa...
Unbelief asked 8/5, 2011 at 15:8

5

Solved

Hello i have some question about java. here is my code: public static void main(String[] args) throws Exception { Process pr = Runtime.getRuntime().exec("java -version"); BufferedReader in = ne...
Cancan asked 16/11, 2011 at 10:7

4

Solved

I have a program Test.java: import java.io.*; public class Test { public static void main(String[] args) throws Exception { System.setOut(new PrintStream(new FileOutputStream("test.txt"))); Sy...
Baksheesh asked 19/1, 2011 at 23:11

7

Solved

I am trying to get the OutputStream of the Process initiated by exec() to the console. How can this be done? Here is some incomplete code: import java.io.BufferedReader; import java.io.File; impo...
Benedikt asked 14/10, 2010 at 17:51

5

Solved

I am working on a simple java program. It simply compiles and executes another java program. I am using Runtime.exec() function to compile and run. There is no problem with compilation. but when it...
Return asked 5/3, 2013 at 8:19

2

I'm trying to install APK in android 7 (samsung and sony) using regular Runtime.getRuntime.exec() routine. The installation fails with the following exception in the logcat: 09-04 14:14:33.932 166...
Denudate asked 4/9, 2017 at 12:17

4

Solved

I'm trying to execute an external command from java code, but there's a difference I've noticed between Runtime.getRuntime().exec(...) and new ProcessBuilder(...).start(). When using Runtime: Pro...
Buchenwald asked 28/7, 2011 at 8:25

5

Solved

In Java, I want to be able to execute a Windows command. The command in question is netsh. This will enable me to set/reset my IP address. Note that I do not want to execute a batch file. Inst...
Shied asked 18/8, 2011 at 18:26

8

Solved

I'm pretty new to Java, need to write a program that listen to video conversion instructions and convert the video once an new instruction arrives. (Instructions are stored in Amazon SQS, but it's ...
Launcher asked 15/8, 2009 at 6:59

4

Solved

am asking this question after doing a lot of research and also implementing it in my code after the research but I ended up with FileNotFoundException.What exactly am doing here is I want to avoid ...
Slouch asked 10/10, 2013 at 19:32

4

Solved

I have this code: File file = new File(path + "\\RunFromCode.bat"); file.createNewFile(); PrintWriter writer = new PrintWriter(file, "UTF-8"); for (int i = 0; i <= MAX; i++) { writer.println(...
Cogitable asked 4/3, 2013 at 10:12

© 2022 - 2024 — McMap. All rights reserved.