Questions tagged [runtime.exec]

The Runtime.exec() method allows Java apps. to create a new OS Process.

The Runtime.exec(...) method (which has 6 overloaded variants) allows Java apps. to create a new system (represented in Java as a Process).

There are common mistakes made when creating new processes - as detailed in When Runtime.exec() won't. The article is the first thing to check if a process fails. Implement all the tips, and even if doing so does not make the process work, it will provide much more detailed information on why it failed.

The ProcessBuilder class introduced in Java 1.5 makes it easier to create and use a process correctly. For example, the redirectErrorStream(boolean) convenience method will merge the System.out & System.err streams, which allows both streams to be consumed in one Thread.

881 questions
-2
votes
1 answer

Invoking ffmpeg from Java correctly

I would like to call on ffmpeg to split a video into frames, I used Process p=Runtime.getRuntime().exec("ffmpeg -i /home/video.mp4 -t 100 -filter:v \"fps=fps=60\" /home/%d.jpeg"); p.waitFor(); But I don't get the desired result. Nothing happens to…
Srini
  • 1,619
  • 1
  • 19
  • 34
-2
votes
2 answers

How to run linux script from Java

I want to run linux script from Java program and continue to execute program only when script stop. I am not interested to read script output ... Can anybody help me? Thanks a lot, and excuse me for my bad English
s0ld13r
  • 775
  • 6
  • 9
-2
votes
2 answers

Running Runtime.exec() doesnt create a file in c++

I have an executable of c++ that opens a file and writes a line to it. Works fine by itself. #include #include using namespace std; int main(){ ofstream fout; fout.open("test.txt"); if(fout.is_open()){ …
Vasilis
  • 107
  • 1
  • 4
-2
votes
2 answers

Use Java to start a Windows exe

I want to find out how to open any exe in Windows using Java code. I have searched Google before and they only show me part of the code that they use, I think, because it doesn't seem to compile. I have downloaded JDK 7 to compile. I don't use…
-2
votes
3 answers

executing unix commands from java using runtime class

Process log_remover = Runtime.getRuntime().exec("echo \"bleh\" > test.txt"); log_remover.waitFor(); log_remover.destroy(); this does nothing Process node_creation = Runtime.getRuntime().exec("cp -r ../HLR"+String.valueOf(count-1)+"…
Atish Deepank
  • 17
  • 1
  • 6
-3
votes
2 answers

Runtime.getRuntime().exec() with gpg command not working

I have gpg command which encrypts the file gpg --batch --yes -o abc.csv.gpg -r 'balu shanmukh' -e A2.java in the above command --batch --yes -o -r and -e are options and balu shanmukh is the value. the command is prepared dynamically and the…
phanikiran
  • 75
  • 1
  • 6
-3
votes
2 answers

how to change .class file to a text file

I'm trying to make a java program which executes java files and gives output in the text field. I've used Runtime class to compile the .java file .So how do I get the output from that newly made class file. Runtime.getRuntime().exec("javac…
Akash
  • 1
  • 1
-3
votes
2 answers

How to close application (stanford: it is a folder consists many programs.) in CMD after I open it? java ProcessBuilder Runtime

Please know that stanford is not exe. it is a folder consists many programs I open the cmd.exe by using following statement: public static void runStanfordCMD() throws IOException{ List cmds = Arrays.asList("cmd.exe", "/C", "start",…
bob90937
  • 553
  • 1
  • 5
  • 18
-3
votes
3 answers

Does any one know exactly what's the utility of this line code " r.exec("C:/Users/May/Desktop/test/c5.0 -f C:/Users/May/Desktop/test/see5/rating") "

This is the line code : r.exec("C:/Users/May/Desktop/test/c5.0 -f C:/Users/May/Desktop/test/see5/rating"); The problem is that I didn't understand the meaning cause I forked the project and I have to change it so to fit my needs. Please can anyone…
imenbouh
  • 3
  • 3
-3
votes
1 answer

DOSBox commands through Java Program-word gets removed

String run="c:\\Program Files\DOSBox-0.74\dosbox.exe dosbox -c mount c c:\games"; The word c c:\games gets removed. Please advise how do I prevent this? Should I use a literal to insert the spaces in the command?
Mayukh Nair
  • 623
  • 1
  • 6
  • 26
-4
votes
1 answer

Remove file using Runtime

I tried to use this code to delete a file located into /data folder but it doesn't work, what's wrong in it? My device has root. Runtime.getRuntime().exec(new String[]{"su","rm"+" "+"/data/logger"}); SOLVED USING THIS Process p; try { …
Hasta'98
  • 184
  • 2
  • 9
1 2 3
58
59