{ This is an exploratory question to just find out if something is possible. }

The facts are these :
1. The java program is closed source, but is running on an accessible workstation.
2. The gui is written in AWT.
3. OS is windows
4. Windows tools like Spy++ can not "see" the components.
5. Rather not use java access bridge, if it can be helped.

Can text from a java Gui be read by another process?

Example solution: Write a small java program that loops through the awt containers to gather the name fields of each item. ( Not sure if thats possible, which is why I'm asking )

Recommended Answers

All 10 Replies

In Windows, there might be a way of accessing those components by using the Window ID handle or something. I'm not entirely sure here, this is just a guess.

good to see that the built-in security of the JVM is working.

good to see that the built-in security of the JVM is working.

Judging by your comment, you are assuming I'm doing this with nefarious intentions?
I didn't think I came across that way, but you have that right.

The purpose of gathering the text is to produce a report that the program does not natively create. I'm making a side program to meet that need in the mean-time.

Member Avatar for electron33

Hi. I don't think you can access another process in JVM. They are completely isolated. It is easier to call the Jar file and get the values from here.

That is helpful, but the program receives the data from a db, so I guess using java is a dead end.

Not at all, you just need to stop wanting to do screenscraping like that :)
Why should we help you create spyware?

Member Avatar for electron33

To add a jar in classpath and to access the classes from the methods they provide is naturale to Java. If the host program is the program that connects to the database. There is always classes that provide functions for you to get this datas. Trying to interupt a nother prosess will most likely cause the other prosess to fail. I don'tn recomment to do it your way by hacking your program into a nother process. This is dead before your got started.

What cind of process or program does you want to hack throug process? if uour are trying to access a windows COM object you must have a bridge for this. if you want to use a nother java app. You simply imports the desired jar archive and start coding of connection to the methods provided from this archive.

Thanks for you help Electron, as I said this was mostly a "what if" question. Win MFC based windows are an open book compared to java gui's when using C, VB, ect languages. I thought perhaps using a java program might allow you to work with other java processes and thus their Gui, this is not the case. Having never written in Java , I just wasn't sure. I am able to accomplish the goal by other means, so not all is lost.

I am able to accomplish the goal by other means, so not all is lost.

Hey could you please explain how you did it?

I've been trying to read stuff from a Java GUI too.
It's for a Java based game, it has this list with item names and prices and I'd like to save a copy of this list for future reference. Of course I'm not gonna copy everything by hand so I had the idea to write a little app to do the dirty job for me.

Its not the cleanest way to get the data, since its for automation, but give Smaragd Robot a try.

If that doesn't work, you can always check the Autoit forums for java game threads. There might be some help buried in there for your purposes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.