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 / August 2006

Tip: Looking for answers? Try searching our database.

standard input/output of a class instance

Thread view: 
guesswho - 30 Aug 2006 12:21 GMT
Hi,

I was wondering if its possible to redirect input and output of a
JClips class .
I hava a java application with instance of JClips class (it makes
possible to fire CLIPS expert system in java), a clips file with code
of expert system where  for example a kind of "c printf function"
prints sth on stdout and like "c scanf function" reads from stdin. Is
it possible to force my JClips instance to read for example from my
edit box
in other words how to redirect standard output/input of a class
instance

thanks for any help
Thomas Fritsch - 30 Aug 2006 12:43 GMT
guesswho schrieb:
> I was wondering if its possible to redirect input and output of a
> JClips class .
It is possible to redirect input and output for the *process* as a
whole. But I don't know what you mean with "redirect input and output of
a *class* ".
> I hava a java application with instance of JClips class (it makes
> possible to fire CLIPS expert system in java), a clips file with code
[quoted text clipped - 4 lines]
> in other words how to redirect standard output/input of a class
> instance
You can redirect standard output/input/error by
  System.setIn(...);
  System.setOut(...);
  System.setErr(...);
See also the API doc of the java.lang.System.

Signature

Thomas

Chris Uppal - 30 Aug 2006 16:04 GMT
> I was wondering if its possible to redirect input and output of a
> JClips class .

I doubt if this is possible through the existing JClips API.  CLIPS itself has
an elaborate framework ("IO Routers") to allow containing applications to take
control of the messages, etc, that CLIPS is producing.  From a quick glance
through JClips I see no way to hook into that framework.

So I think the options are: give up, or extend JClips (not necessarily too
dificult if you are comfortable working in C).

   -- chris
guesswho - 30 Aug 2006 19:40 GMT
Chris Uppal napisal(a):

> > I was wondering if its possible to redirect input and output of a
> > JClips class .
[quoted text clipped - 8 lines]
>
>     -- chris

... or maybe send sth to stdin from java application. Clips asks a
question in stdout (and sends string containing question to java app -
in JClips send-to-java func.) and is waiting for an answer from stdin
(keyboard) , so maybe write the answer to stdin from java app.  Does it
makes sense ?
Chris Uppal - 31 Aug 2006 10:36 GMT
> Clips asks a
> question in stdout (and sends string containing question to java app -
> in JClips send-to-java func.) and is waiting for an answer from stdin
> (keyboard) , so maybe write the answer to stdin from java app.  Does it
> makes sense ?

I don't see how to make that work myself, although I could be missing something
(I haven't looked into CLIPS much yet).

I don't think it's possible to do from outside CLIPS -- you just don't have
access from Java to the stdin and stdout streams that its C library is using.

You could probably do it by running CLIPS as an external process, which /would/
allow you to take control of its stdin/stdout -- but then you wouldn't be able
to use JClips.

   -- chris


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.