How to remote-control a Java app?

R

Ramon F Herrera

I am developing a two-application system. The two apps sit side-by-
side on the monitor, and I need to squeeze every square inch of screen
real state. One of the applications in written in Java by myself and
the other is the well-known Adobe Acrobat.

My question is related to controlling the two windows and placing them
in the correct places on the screen (exactly half and half). A
controlling program can exec my Java app and tell it to place itself
on the left side of the screen, at coordinates such-and-such, by
parameter passing. Similarly, it can start Acrobat telling it (I hope
there is a way to accomplish this) to locate itself on the right side.

So far, so good. What happens, however, if the applications are
already running in some undesirable spot? I don't want to kill it and
restart it, I just want to tell it: "please move over to your correct
spot". So I will need to sent to some sort of message to the Java app.
The COM/CORBA techniques come to mind, in which the application is
remote controlled. How should I build my app to accept this kind of
control from an outside program? I guess I will need to publish some
interfaces and methods. I would definitely prefer to use any standard
(read: non-Microsoft) component model.

Then, there is the issue of how to control Acrobat, but I guess that
is better left for another forum.

-Ramon
 
S

Stefan Ram

Ramon F Herrera said:
restart it, I just want to tell it: "please move over to your correct
spot". So I will need to sent to some sort of message to the Java app.

I believe, the most portable means for interprocess communication
is a socket.

You could use protocols like SOAP or REST on top of it or specify
your own simple mini-protocol.

There also are JNI-based Java-COM-bridges available.

When a window is know to appear at a certain position, it also
might be possible to move or resize it (as a last ressort) via

http://download.java.net/jdk7/docs/api/java/awt/Robot.html
 
R

Ramon F Herrera

I believe, the most portable means for interprocess communication
is a socket.

You could use protocols like SOAP or REST on top of it or specify
your own simple mini-protocol.

There also are JNI-based Java-COM-bridges available.

When a window is know to appear at a certain position, it also
might be possible to move or resize it (as a last ressort) via

http://download.java.net/jdk7/docs/api/java/awt/Robot.html
> I believe, the most portable means for interprocess
> communication is a socket.

I have an almost religious issue against placing a server program in a
client machine. That's an abominable practice done mostly by
Microsoft. I want to make sure that both programs (controlling and
controlled) run on the same computer. No socket listening.

Thanks!

-Ramon
 
S

Stefan Ram

Ramon F Herrera said:
I have an almost religious issue against placing a server
program in a client machine.

A program waiting for some commands from another program, a
»remote-controlable« program, just happens to /be/ a server
program, whether it accepts commands via a socket or via COM.
 
R

Ramon F Herrera

A program waiting for some commands from another program, a
»remote-controlable« program, just happens to /be/ a server
program, whether it accepts commands via a socket or via COM.

Well, now we are getting into terminology and nomenclature. It all
depends on the definition of server. For the purposes of this
discussion, I am conveniently restricting the definition of server and
client, to programs running in different computers. The kind of server
I do not want to use is the one that listens to sockets to connect
request from arbitrary machines. Let's just say that my PC does not
have a network card or a loopback. There is no TCP/IP stack in it.

-Ramon
 
D

Daniel Pitts

Ramon said:
Well, now we are getting into terminology and nomenclature. It all
depends on the definition of server. For the purposes of this
discussion, I am conveniently restricting the definition of server and
client, to programs running in different computers. The kind of server
I do not want to use is the one that listens to sockets to connect
request from arbitrary machines. Let's just say that my PC does not
have a network card or a loopback. There is no TCP/IP stack in it.

-Ramon
To quote Ralph Wiggum, That's unpossible!

The most portable way to communicate between two programs is to use
Sockets. You may be able to use Pipes too, depending on the system
you're on. Otherwise I'd think you'd have to use JNI and some
proprietary way.
 
L

Lawrence

If you just need to resize the application and put it in the right
place, why don't you just use a little program that uses windows API
to do that ? You can move windows, resize them, etc.
 
R

Ramon F Herrera

If you just need to resize the application and put it in the right
place, why don't you just use a little program that uses windows API
to do that ? You can move windows, resize them, etc.

Are you saying that a third, unrelated application, can move and the
resize the windows of:

- my Java program
- Adobe Acrobat

Is that the case?

I always make heroic attempts to try to stay as independent of
Microsoft as possible, but your suggestion sounds like a good starting
solution, to be improved later.

-Ramon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top