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 / GUI / March 2006

Tip: Looking for answers? Try searching our database.

java program in java GUI

Thread view: 
CSUIDL PROGRAMMEr - 29 Mar 2006 01:43 GMT
folks
I am writing a java GUI that calls other  java programs
i want to execute java command line options in back ground. I am using
java exec command
this is part of code

Runtime.getRuntime().exec("/root/java/jdk1.5.0_06/bin/java
/root/Desktop/project/SAXXMLHandler");

where i want to run SAXXMLHandler java file

But i dont get any output

thanks
Nigel Wade - 29 Mar 2006 09:35 GMT
> folks
> I am writing a java GUI that calls other  java programs
[quoted text clipped - 8 lines]
>
> But i dont get any output

What output did you expect? We have no clue as to
what /root/Desktop/project/SAXXMLHandler is supposed to produce.

How do you determine that there is no output?

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

CSUIDL PROGRAMMEr - 29 Mar 2006 15:43 GMT
well the output should say that

Usuage: java parser

as i am not passing any arguments

In my command line i do not get anything

thanks
Oliver Wong - 29 Mar 2006 16:46 GMT
> well the output should say that
>
[quoted text clipped - 5 lines]
>
> thanks

See http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html

<quote>
All its standard io (i.e. stdin, stdout, stderr) operations will be
redirected to the parent process through three streams (getOutputStream(),
getInputStream(), getErrorStream()). The parent process uses these streams
to feed input to and get output from the subprocess. Because some native
platforms only provide limited buffer size for standard input and output
streams, failure to promptly write the input stream or read the output
stream of the subprocess may cause the subprocess to block, and even
deadlock.
</quote>

   - Oliver
Big Jim - 29 Mar 2006 19:47 GMT
> well the output should say that
>
[quoted text clipped - 5 lines]
>
> thanks

you need to "process" the output by getting the standard streams from the
new process. Probably best to start new threads to do this if you don't want
to hold up your "parent" program.
CSUIDL PROGRAMMEr - 31 Mar 2006 22:06 GMT
how do i do that
i mean start new threads
thanks
Oliver Wong - 31 Mar 2006 22:23 GMT
> how do i do that
> i mean start new threads
> thanks

A google search for "java thread" (without the quotes) gives me:
http://java.sun.com/docs/books/tutorial/essential/threads/

   - Oliver


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



©2008 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.