Problem with Runtime execute

F

Fran Garcia

I wanna execute a dos command into Runtime envinroment in my Applet
and I get the next problem:

I have the next code:

try {
Process p = Runtime.getRuntime().exec(
"lame file.wav file.mp3");
}catch(Exception ex){
ex.printStackTrace();}

I wanna convert a wav file into a mp3 file with this exec and it works
fine but I must close my Internet Explorer with the Applet. While I
don´t close my IE, the new mp3 file has 0 bytes, but when I close this
IE the file has the correct size. Somebody can help me with that?
Somebody knows why it causes that?

Thanks in advance

Fran García
 
S

Sudsy

Fran said:
I wanna execute a dos command into Runtime envinroment in my Applet
and I get the next problem:

I have the next code:

try {
Process p = Runtime.getRuntime().exec(
"lame file.wav file.mp3");
}catch(Exception ex){
ex.printStackTrace();}
<snip>

Check the javadocs for Process#waitFor.
 
F

Fran Garcia

I will reply to myself. I have put the next code and it works fin

try {
Process p = Runtime.getRuntime().exec(
"lame -b 8 -f -m j GRABANDO_DE_WEB.WAV nompractica.wav.mp3");
p.getOutputStream().close();
p.getInputStream().close();
p.getErrorStream().close();
p.waitFor();
}catch(Exception ex){
ex.printStackTrace();}

I hope that somebody can use this code.

Ciao
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top