Problem with Runtime execute

Discussion in 'Java' started by Fran Garcia, Nov 24, 2004.

  1. Fran Garcia

    Fran Garcia Guest

    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
    Fran Garcia, Nov 24, 2004
    #1
    1. Advertising

  2. Andrew Thompson, Nov 24, 2004
    #2
    1. Advertising

  3. Fran Garcia

    Sudsy Guest

    Fran Garcia wrote:
    > 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.

    --
    Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.
    Sudsy, Nov 24, 2004
    #3
  4. Fran Garcia

    Fran Garcia Guest

    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
    Fran Garcia, Nov 25, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    317
    Giovanni Bajo
    Jan 14, 2006
  2. Replies:
    0
    Views:
    430
  3. Replies:
    1
    Views:
    521
    Andreas Leitgeb
    Nov 30, 2006
  4. Savas Ates
    Replies:
    1
    Views:
    276
    Patrice
    Aug 17, 2004
  5. batham

    Execute <script> during runtime.

    batham, Dec 20, 2005, in forum: Javascript
    Replies:
    5
    Views:
    104
Loading...

Share This Page