Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

It is possible to control a java application from a delphi written application?

Tags:

java

delphi

My problem is pretty simple i have an application written in java and i want to send commands to it ex ( click a button , send some key strokes , click a menu item ) from my application witch i will write in delphi. Is this concept even possible ?

like image 517
opc0de Avatar asked Jun 22 '11 11:06

opc0de


1 Answers

I actually had to do this at the last place I worked, you can get around it with complex window events etc... as mentioned above but if you have access to the Java source simply write other access methods either that call a specific runtime that closes (i.e. trigger a public static void main(String[] args); via a native call or via the command line.

OR

Implement simple a simple message system between Java/Delphi over TCP/IP and send either XML or some simple string mappings (I think it took about an hour to set up Maps that could pass back and forth).

In my case we were simply handling reporting and talking to the database so it was pretty easy to work around without getting into a native call. Alternatively, there is(was) a port of the JNI for Delphi that worked pretty well with Delphi 7. I have no clue what runtime you're using but it might be an option.

Honestly, the TCP/IP method is probably the easiest. It doesn't take a lot to implement, it doesn't eat a lot of resources and it allows you to execute "myMenuItem.onClick()" pretty easily as a packet, you just have to expose the methods.

http://home.pacifier.com/~mmead/jni/delphi/

like image 82
Daniel B. Chapman Avatar answered Oct 06 '22 01:10

Daniel B. Chapman