Java codes to lock the desktop

abrosft

Distinguished
Dec 10, 2011
2
0
18,510
i need the java codes with explanation how to lock the desktop when a customer is using a PC if his time period is over through the time taken from the database of the server machine which i / owner uses
 

Rusting In Peace

Distinguished
Jul 2, 2009
312
0
19,060
I doubt you can do this directly from Java because it's an insecure operation and different OSs handle desktop locking in different ways.

The best you could hope for is to use Runtime.getRuntime().exec() to call an external process. However even then I don't know of anything that does this. Locking the desktop is really a user controlled action. I don't know if it can be done programmatically for security reasons.
 

Ijack

Distinguished
I'm guessing that this is either (1) an internet cafe scenario, (2) a corporate network scenario, or (3) a prank that you wish to play on people.

If (1) get hold of some proper interenet cafe software. As you metion "customer" this seems to be the most likely option.

If (2) use the facilities built into Windows Server to manage logon times.

If (3) - and the request for a solution using a specific language makes me think this is most a possibility - forget it.