Re: Calling a shell function
From: Amey Samant (ameyas7_at_yahoo.com)
Date: 10/06/03
- Next message: Frank Brouwer: "Memory issue"
- Previous message: SPG: "Re: Constructors"
- In reply to: John Bowling: "Calling a shell function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 6 Oct 2003 07:52:56 -0700
"John Bowling" <johnlb2002_TAKEOUT_@cox.net> wrote in message news:<dfXfb.51546$vj2.1114@fed1read06>...
hi John
java.lang.Runtime class should solve your problem
you can exec (no need to fork in java ;) its taken care of inside
exec) a command/program just the way you run it on your shell.
it creates a Process object & you can then get its
outputstream,inputsream to give input, output to the process.
the sequence is
invoke program
feed input to the Process
get the output from the Process
but the problem could arise if you invoke a program that has sequnce
of i/p,o/p , i/p , o/p & in random order with o/p in between
then you will not be able to see o/p unless your process has fifnished
& you read it.
that means if your program says "Enter a number : " & reads a number
then you will have to enter the number first & only when your program
is finished you shall see "Enter a number : " in its o/p :D
thus asynchronous i/o is not directly supported
i was writing a shell in java (as it can be then portable to all
platforms) but i got stuck with this, & i found that this can be
resolved only if you opt for JNI which makes the shell native :( . so
i dropped it altogether.
however i have seen some of shells written in java, i dont know if
they did use JNI or without it.
regards
amey
- Next message: Frank Brouwer: "Memory issue"
- Previous message: SPG: "Re: Constructors"
- In reply to: John Bowling: "Calling a shell function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|