• Post Reply Bookmark Topic Watch Topic
  • New Topic

Connecting to running java process  RSS feed

 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to be able to connect and run methods from an existing class that is running as a daemon process on a UNIX system. How do I issue commands / method calls from an external class to interact with the running process?

Thanks in advance.
[ July 13, 2007: Message edited by: Sam Smoot ]
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The running class probably needs to be a server of some kind, with server loosely defined as any process that waits for requests from clients.

It's pretty easy to write a socket server that accepts simple string requests from clients and sends string responses. See the Sun Networking Tutorial for details - the Socket chapter builds simple clients and servers you can largely borrow.

Other forms of "being a server" get more complex but might be appropriate if you need to have more complex conversations between objects. RMI might be the next step up the ladder.

Does that seem to fit the problem?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!