File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Distributed Java and the fly likes Capture Currently running application and share with a remote host Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Reply Bookmark "Capture Currently running application and share with a remote host" Watch "Capture Currently running application and share with a remote host" New topic
Author

Capture Currently running application and share with a remote host

Lakshitha Ranasinghe
Greenhorn

Joined: Mar 26, 2006
Posts: 3
There is a issue which I faced during the development of the web conferencing tool using java,

That is Currently Im using C library to implement the Application sharing option. That C classes capture the Process ID (in Windows platform's Task manager displayiing processes)of the currently running program and pass it to the remote host.

Im going to implement it using java and Is there a way to achieve that application sharing feature in Java, any new classes in java 5.0?

Please help to resolve this matter,

Thanks,
Lakshitha
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12265
    
    1
That does not sound like the Java approach to a distributed application.

The Java approach would work at a more abstracted level using the many powerful networking tools and would not care about the process id.

You should step back from the keyboard and go read about Java networking technology like RMI, Jini, and Java Message Service and web services in general.

If this conferencing tool really does need to live on the web you will find it a lot easier to work with toolkits designed to send messages over the net.

Tell us more about your requirements - what does this application actually do?

Bill
[ March 27, 2006: Message edited by: William Brogden ]

Java Resources at www.wbrogden.com
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

"lakshitha@CSL Ranasinghe" -

Welcome to the JavaRanch! We don't have many rules around the ranch, but we do have a policy on displayed names... Please adjust your displayed name to meet the
JavaRanch Naming Policy. User names cannot be obviously fake and must constist of a first name and a last name.

You can change your user name here.

Thanks! and welcome to the JavaRanch!


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Lakshitha Ranasinghe
Greenhorn

Joined: Mar 26, 2006
Posts: 3
Thanks for the clarifications which you have done for me.I really appreciate it.
My application is like this, There is a main Java application which is running as the host and also there are many client applications which communicate with that host application. (This tool like WebEx conferencing tool)

The network architecture is P2P and we are using JXTA for that. Host can start the meetings and invite to the clients/guests to join with that meeting. There are some features which can use to communicate each other.

Among them the chat service, whiteboard, desktop sharing and hot application sharing to the clients are functioning.

My requirement is that implement the host application sharing(Application means that the Currently running program in the host machine ex: JBuilder.exe) to the client using java. Because its now implemeted with C library.

I hope this clarification is helped to you, Please explain me about the which java technology should use for such a task.

I should thank Mr. William for his comments as well as I have referred your site too.

Thanks and Regards
Lakshitha
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12265
    
    1
My requirement is that implement the host application sharing(Application means that the Currently running program in the host machine ex: JBuilder.exe) to the client using java. Because its now implemeted with C library.


Let me see if I understand this - you want the client machine to see the application currently running on the server as if it is running on the client, and this application is a C .exe program?

That is way too machine specific for Java. You might be able to capture a screen shot on the "server" side and transmit that image, but Java does not provide ways to send GUI events to a C program.

The users could run one of the virtual PC programs that are Windows specific, such as PCanywhere, and interact with the application, but it would not be under Java control and only one user at a time could control the application.

Bill
Lakshitha Ranasinghe
Greenhorn

Joined: Mar 26, 2006
Posts: 3
hi,

Actually this is not what really want, Lets think we are working in the windows platform, If I can Identify the currently running processes (by Id or any other way)I can transfer it to the remote computer. For now what I want is that to capture the currently running program processes using java technology.

Thank you very much for your replies Bill

Best regards
Lakshitha
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12265
    
    1
If you can find a operating system utility that lists the applications and process IDs to the command line, you can use the Runtime exec capability to execute that utility and catch the output text lines.

?Transfer a running process to a remote computer?
Bill
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Originally posted by Lakshitha Ranasinghe:
If I can Identify the currently running processes (by Id or any other way)

On the Windows Platform the process ID is not a reliable method of identifying processes. On unix it's "pretty" reliable as process IDs are used sequentially until rollover is necessary. On Windows new processes will reuse process IDs of recently deceased processes. In C/C++ or .NET you have to obtain the process handle and associate that with an unique external identifier like an User ID or Session ID to track the identity of the process in the program and to relate it to that external entity.

So basically hold on to the Java Process object that is created and assign it an identity that makes sense within your application and store that pair somewhere (e.g. Hashmap).

That being said, you can always use the Tasklist command (from java.lang.Runtime.exec() or java.lang.ProcessBuilder) and parse (or regex match) its output looking for your image names (e.g. myProgram.exe) and the associated process IDs. However just because there was a "myProgram.exe 1396" 20 minutes ago, doesn't necessarily imply that the current "myProgram.exe 1396" is the same process instance. The one from 20 minutes ago may have died and a new "myProgram.exe" may have gotten its process ID.
[ March 29, 2006: Message edited by: Peer Reynders ]

"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: Capture Currently running application and share with a remote host
 
Similar Threads
rmic and J2SE 6
please help .very urgent
How to Capture the Screen of a Remote system ?
Writing a file from an Applet
FTP Upload