The Source for Java Technology Collaboration

Home » java.net Forums » JDK » Java SE

Thread: using simple io to communicate between java and non-java applications!???

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 7 - Last Post: Aug 31, 2006 2:35 AM by: nitrambass
jeremygwa

Posts: 67
using simple io to communicate between java and non-java applications!???
Posted: Aug 13, 2006 5:21 PM
  Click to reply to this thread Reply

I need to get java to talk to another application.

I am considering using the basic stdin,stdout pipes and setting a non java app(win32) as a subprocess to a java app, therefore it would communicate with simple io.

My question is, what are the pros and cons of this setup. when would such a setup fail or not be appropriate, in which I would have to resort to using network sockets (webservices etc)?, or having to communicate by disk file?

eg, would any issue arise, If the end product were to be a console-based application etc...?
would any issue arise, If the end product were to be a gui only application etc?....or how about
a multi-threaded product?


Thanks in advance for your help.

-Jeremy A.

coxcu

Posts: 184
Re: using simple io to communicate between java and non-java applications!?
Posted: Aug 14, 2006 7:24 AM   in response to: jeremygwa
  Click to reply to this thread Reply

Without more specifics, it's difficult to give you much useful advice. Consider the following:
1) For Java-to-Java RMI is usually your best bet.
2) If you need to support langauges that don't run on a JVM, or work across firewalls, consider web services.
3) XML-RPC is probably available any place you need it.
http://www.xmlrpc.com/directory/1568/implementations
4) Using stdin/stdout is fine as long as the communication is relatively simple. Just remember to flush the streams.

- Curt

alski

Posts: 15
Re: using simple io to communicate between java and non-java applications!?
Posted: Aug 14, 2006 11:33 AM   in response to: jeremygwa
  Click to reply to this thread Reply

...and what's wrong with using localhost sockets?

gmoniey

Posts: 19
Re: using simple io to communicate between java and non-java applications!?
Posted: Aug 14, 2006 1:01 PM   in response to: jeremygwa
  Click to reply to this thread Reply

if your other application is written in C/C++, you may want to look into JNI.

jeremygwa

Posts: 67
Re: using simple io to communicate between java and non-java applications!?
Posted: Aug 14, 2006 3:41 PM   in response to: gmoniey
  Click to reply to this thread Reply

I have no experience with jni, and prefer a 100% java coded solution for the parent process. the subprocess is not c++, and I dont want to use a glue(middle) language.

I am assuming that if i were to write a console application, using stdin/stdout pipes for communication with the subprocess would not be appropriate, because it will interfear with user stdin/stdout, thus not producing the proper cosmetic or user experience. Am I correct?

would this setup, (piped stdin/stdout/subprocess) be best for gui only applications?

Also, I prefer not to use sockets for this local setup, as that damages the user-experience, especially with firewall applications like zone-alarm, or NIS, so I guess I am left with disk-file-io for console only application.

jeremygwa

Posts: 67
Re: using simple io to communicate between java and non-java applications!?
Posted: Aug 16, 2006 1:52 PM   in response to: jeremygwa
  Click to reply to this thread Reply

Maybe I am not being clear of what I want answer for.

take the following statement.

using stdin/stdout pipes to talk to the non-java subprocess, will damage the
user experience of the product being that of an "Interactive Console
Application", because the user experience involves stdin/stdout.

Am I correct?

Thanks in advance for all your replies.

-Jeremy A

gmoniey

Posts: 19
Re: using simple io to communicate between java and non-java applications!?
Posted: Aug 16, 2006 2:08 PM   in response to: jeremygwa
  Click to reply to this thread Reply

you still havent mentioned what the other language is written in, but i would go with alski's suggestion of using sockets...

nitrambass

Posts: 4
Re: using simple io to communicate between java and non-java applications!?
Posted: Aug 31, 2006 2:30 AM   in response to: jeremygwa
  Click to reply to this thread Reply

For years my company has been marketing a solution that web-enables an otherwise non-enabled application written in C by fronting it with a Java adapter that talks to it via stdin and stdout.

It has proved performant, stable, scalable, robust, very simple to develop and maintain, and runs on windows and UNIX platforms with no change to the Java or the C stdin/stdout communication logic.

This same adapter works standalone and, with appropriate JCA permissions set, as a resource adapter in any standard (and up to date) J2EE application server, again with impressive stability etc (which, I have to admit, cannot always be said of the application WITHOUT the adapter!)

Hope that testimony helps!


Message was edited by: nitrambass





 XML java.net RSS