Interact with a Java applet on a website

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

Mavrisa
Posts: 340
Joined: Mon Dec 22, 2008 8:49 pm UTC
Location: Ontario

Interact with a Java applet on a website

Postby Mavrisa » Thu Jun 09, 2011 1:56 pm UTC

Hi,
There's a utility my company uses on the interblag that is a java applet which allows us to download certain data that we need. The problem is that the process involved is a very long, repetitive one, and I've been asked to see if there's any way I could automate it.
To be honest, I'm not really sure where to start. I did a few google searches, but all I came up with was "it's hard". Apparently, java applets just look to most scripting languages like a picture on the page.
Thanks for any help anyone can offer.
"I think nature's imagination is so much greater than man's, she's never gonna let us relax."

Pepve
Posts: 57
Joined: Wed Jul 28, 2010 9:47 am UTC

Re: Interact with a Java applet on a website

Postby Pepve » Thu Jun 09, 2011 4:00 pm UTC

The applet gets its data from some place. You could try to reverse engineer the protocol it uses to get the data and implement it yourself.

Otherwise maybe look into an OS-level automation tool, but i have no experience with that.

User avatar
Robert'); DROP TABLE *;
Posts: 730
Joined: Mon Sep 08, 2008 6:46 pm UTC
Location: in ur fieldz

Re: Interact with a Java applet on a website

Postby Robert'); DROP TABLE *; » Thu Jun 09, 2011 5:06 pm UTC

AutoHotKey would allow you to automate the keyboard and mouse to manipulate the applet if nothing else worked.
...And that is how we know the Earth to be banana-shaped.

User avatar
diabolo
Posts: 72
Joined: Fri Aug 08, 2008 4:17 pm UTC
Location: france

Re: Interact with a Java applet on a website

Postby diabolo » Thu Jun 09, 2011 5:21 pm UTC

Pepve wrote:The applet gets its data from some place. You could try to reverse engineer the protocol it uses to get the data and implement it yourself.

I'd suggest looking this way first too. The applet runs on your machine and gets data from a server somewhere. It would be better to make a program pretending to be the applet than a program pretending to be a user using the applet.
I'm not sure if Firebug can see the http requests a java applet makes but this is what I would check first.

Mavrisa
Posts: 340
Joined: Mon Dec 22, 2008 8:49 pm UTC
Location: Ontario

Re: Interact with a Java applet on a website

Postby Mavrisa » Thu Jun 09, 2011 5:28 pm UTC

Yeah, I found something similar in Java (the Robot class... you can move the mouse, press and release the mouse button and press and release keys) but I was hoping there was some library you could use in C#, python, java or whatever has an internal web browser and do it that way. Using this kind of thing, you have to leave it alone while it runs through the process. Otherwise you'll mess it up and it'll never know and just keep plowing on, clicking and typing away.
Anyway, this isn't ideal is I guess what I'm trying to say, but it'll work if absolutely necessary. I suppose it can always be run overnight and keep our fingers crossed that it's working sort of thing.
Anyway, thanks for your help so far. If anyone has anything else, let me know.
"I think nature's imagination is so much greater than man's, she's never gonna let us relax."

Pepve
Posts: 57
Joined: Wed Jul 28, 2010 9:47 am UTC

Re: Interact with a Java applet on a website

Postby Pepve » Thu Jun 09, 2011 6:00 pm UTC

Thought of another option, it requires some Java-fu. Download the applet and unpack it. Decompile the classes. Figure out how everything works. Write your own program to get the data you want, using the applet as a library. The last step has variations, depending on your findings in the figuring-everything-out step. Maybe you need to get the applet running and fire events. Maybe you find that it's got a lovely design and you can just call new NiceServiceImpl("example.com").getMyFrickinData();

I can recommend Java Decompiler as a, well, Java decompiler.

Mavrisa
Posts: 340
Joined: Mon Dec 22, 2008 8:49 pm UTC
Location: Ontario

Re: Interact with a Java applet on a website

Postby Mavrisa » Thu Jun 09, 2011 8:54 pm UTC

Oh... my goodness. This is the largest most convoluted bunch of class files I have ever seen. This may take some time. But thanks.
"I think nature's imagination is so much greater than man's, she's never gonna let us relax."


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 5 guests