File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes executing a java program from web client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "executing a java program from web client" Watch "executing a java program from web client" New topic

executing a java program from web client

R lolabhattu

Joined: Sep 16, 2007
Posts: 3
I have a web application(in tomcat), and I would like to open two clients (client1, client2) on different machines (machine1, machine2). I would like to execute java program on machine2 from client on machine1(client1).
Is it possible, If so please suggest me one.

R Lolabhattu
Pat Farrell

Joined: Aug 11, 2007
Posts: 4659

You can do anything if you try hard enough.

But this is really a bad idea, unless I'm not understanding what you want.

Normally, you have a server running Tomcat (it can be a normal PC, but you need to think of it as a server) and one or more clients.

If I understand you, you want to have one server and two clients, and when Client1 does something, you want to "execute a program' on Client2.

This sounds a lot like a virus or malware. It is bad security. Nothing you do on Client 1 should change what is executing on Client 2. Ever.

You could use AJAX to have Client 1 set a state on the server that is visible to Client2, and triggers some AJAX response. This could appear to work the way you describe. But in reality, the clients were running the AJAX code before you started, and you just returned data.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Fog Creek CoPilot does exactly this. Both client machines log in to a server and one can take over the other. It was written by a couple interns as a summer project (!) Reading about it may give you some ideas.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
R lolabhattu

Joined: Sep 16, 2007
Posts: 3
Thank you, I wanted same like CoPilot, my application did not require this many features, I would just like to execute a java program. I would read about this now. If anybody knows about it please let me know. Thank you.
subject: executing a java program from web client
It's not a secret anymore!