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();
}
}
}
Joshua Cranmer - 03 Mar 2007 19:42 GMT
> 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.
Nicola Turri - 04 Mar 2007 14:20 GMT
I have tried with cmd /c javaws -wait my.jnlp
but it does not work unfortunately :)
Joshua Cranmer - 04 Mar 2007 19:02 GMT
> 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?
Nicola Turri - 05 Mar 2007 10:24 GMT
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
Andrew Thompson - 06 Mar 2007 00:34 GMT
> 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.
Nicola Turri - 06 Mar 2007 09:41 GMT
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 .