is possible capture InputStream Process to javaws application from another?

Discussion in 'Java' started by Nicola Turri, Mar 3, 2007.

  1. Nicola Turri

    Nicola Turri Guest

    Hello i have simple problem when launch java web start application to
    another java program.


    I do not succeed to capture the system.out of the application javaws.

    what is problem?

    this is my simple example.


    import java.io.*;

    public class Demo {
    static void Demo()throws IOException {

    // start the ls command running

    Runtime runtime = Runtime.getRuntime();
    Process proc = runtime.exec("javaws
    http://localhost:7080/myapp/myapp.jnlp" );

    // put a BufferedReader on the ls output

    InputStream inputstream =
    proc.getInputStream();

    InputStreamReader inputstreamreader =
    new InputStreamReader(inputstream);
    BufferedReader bufferedreader =
    new BufferedReader(inputstreamreader);


    // read the ls output

    String line;
    while ((line = bufferedreader.readLine())
    != null) {
    System.out.println(line);
    }

    // check for ls failure

    try {
    if (proc.waitFor() != 0) {
    System.err.println("exit value = " +
    proc.exitValue());
    }
    }
    catch (InterruptedException e) {
    System.err.println(e);
    }
    }



    public static void main(String[] args)
    {

    try
    {

    Demo();
    }
    catch(Exception ex)
    {
    ex.printStackTrace();

    }

    }
    }
     
    Nicola Turri, Mar 3, 2007
    #1
    1. Advertising

  2. Re: is possible capture InputStream Process to javaws applicationfrom another?

    Nicola Turri wrote:
    > Hello i have simple problem when launch java web start application to
    > another java program.
    >
    >
    > I do not succeed to capture the system.out of the application javaws.
    >
    > what is problem?


    The javaws tool, by default, exits the application before the
    application finishes, so there is no output to capture. If you ran the
    command as javaws -wait it should work.
     
    Joshua Cranmer, Mar 3, 2007
    #2
    1. Advertising

  3. Nicola Turri

    Nicola Turri Guest

    I have tried with cmd /c javaws -wait my.jnlp

    but it does not work unfortunately :)
     
    Nicola Turri, Mar 4, 2007
    #3
  4. Re: is possible capture InputStream Process to javaws applicationfrom another?

    Nicola Turri wrote:
    > I have tried with cmd /c javaws -wait my.jnlp
    >
    > but it does not work unfortunately :)
    >
    >
    >

    The answer is probably yes, but are you sure it actually produces output
    on the output stream and not the error stream?
     
    Joshua Cranmer, Mar 4, 2007
    #4
  5. Nicola Turri

    Nicola Turri Guest

    Hello, they are sure because the escape of the System.out.println , i see it
    in java the java console .

    perhaps it exists is a bugs with javaws.exe ?

    Thanks
     
    Nicola Turri, Mar 5, 2007
    #5
  6. On Mar 4, 1:01 am, "Nicola Turri" <> wrote:
    > Hello i have simple problem when launch java web start application to
    > another java program.


    What are you actually attemtping to achieve here?
    Do you control the code for both apps., and will
    they be coming of the same domain?

    (You might look to using the persistence service
    fo the JNLP API - if both the above are 'yes', or
    sockets, to communicate between the two apps.)

    Andrew T.
     
    Andrew Thompson, Mar 6, 2007
    #6
  7. Nicola Turri

    Nicola Turri Guest

    Thanks for the answer,

    me remain always the doubt of because this not functions.

    also on the forum of the Sun they have not known give me of the answers.

    http://forum.java.sun.com/thread.jspa?threadID=5143600

    I have uncovered that also other persons have the same problem .
     
    Nicola Turri, Mar 6, 2007
    #7
    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. Roedy Green

    Where is javaws.exe??

    Roedy Green, Oct 19, 2003, in forum: Java
    Replies:
    51
    Views:
    14,116
    Roedy Green
    Oct 29, 2003
  2. Ahmed Moustafa

    javaws.jar or jnlp.jar?

    Ahmed Moustafa, Jul 14, 2004, in forum: Java
    Replies:
    0
    Views:
    801
    Ahmed Moustafa
    Jul 14, 2004
  3. R
    Replies:
    5
    Views:
    2,146
    Kevin McMurtrie
    Mar 13, 2005
  4. Roedy Green

    Javaws.exe

    Roedy Green, Jun 24, 2005, in forum: Java
    Replies:
    2
    Views:
    1,783
    Alexey Osyatnikov
    Jun 24, 2005
  5. Andrew Thompson

    Output from javaws Process

    Andrew Thompson, Feb 9, 2009, in forum: Java
    Replies:
    4
    Views:
    1,760
    Andrew Thompson
    Feb 10, 2009
Loading...

Share This Page