Solved

Injecting Text into a running java application

Posted on 2012-12-26
2
173 Views
Last Modified: 2013-02-04
I have a java app that i launch via a script that calls a .jar file.  That app (awt) is just a big form with jbutton and etc.  i DO NOT have the java source code for this app.

Is it possible to create a second app that will AUTOFILL corresponding fields with values retrieved from the db?

For example:  First name is entered into a webform, gets stored in a database and when the "second app" is executed it pulls the data and inserts it into the corresponding mapped field.

Decompiling is not an option as the app gets updates every now and then.

Need an out of the box solution!
0
Comment
Question by:Squadless
2 Comments
 
LVL 27

Accepted Solution

by:
dpearson earned 500 total points
ID: 38722420
Your best bet is to explore the "Robot" class:
http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html

This will let you generate mouse events and keyboard events directly.  You should store the location of the fields on the webform in the second app alongside the data that should be entered in the field.  Then you can move the mouse to the correct place on screen, click in the text field and then send keyboard events to type in the values you wish to enter.

When the app is updated, you may need to update the location of the fields if they have moved to a new position on the screen.

Hope that helps,

Doug
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38724300
Might be worth a look at http://teststack.github.com/White/
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question