Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

is possible capture InputStream Process to javaws application from another?

Thread view: 
Nicola Turri - 03 Mar 2007 15:01 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?

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 .


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.