Click here to Skip to main content
15,894,050 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i want to build an application in java swing in which the server should come to know whether the client is working on his computer or not which is in the sense it is the idle time of the client.
Is there a way to find out the system idle time of a remote computer using java.The program should run from my pc and should show a message box if the remote user is idle for 10 minutes.

I hope you get me.



thank you.
Posted
Updated 6-Feb-10 18:15pm
v2

If your remote machine is windows, then you can use remote wmi to do this. Just google WMI CPU Usage and Remote WMI. WMI is COM - so you'll have to then build some form of bridge from Java to COM. If the remote machine is not Windows - then there are tools out there like good old TOP - but you'll have to then figure out how to get that data back in the way you want.

I suspect the very easiest (maybe not the nicest) is to create a VBScript to monitor the remote machine using WMI and write the result to stdout. Then launch that script via "cscript script.vbs" using the Java something like this:

MIDL
Process p = Runtime.getRuntime().exec("script scripts.vbs");
 
Share this answer
 
The hard way
http://ochafik.free.fr/blog/?p=98[^]

The easy way
use a timer and tasklist.exe
 
Share this answer
 
This can only work if you have some process on the remote computer that captures the information for you.

Following on from Alex's comprehensive answer I took a quick look at Remote WMI and I agree that may well offer what you need. However, to access that through Java you would need to use either the JNI[^] interface, with your own C++ library, or you may be able to do it direct with JNA[^].
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900