try { Runtime.getRuntime().exec("shutdown /h"); } catch (IOException ex) {}
Tutorials, tips and tricks about java programming language. Answers for many doubts about java programming language. Answering many howtos. Sample java projects and source code, java games, java programs for java practical labs.
Search This Blog
Showing posts with label logoff. Show all posts
Showing posts with label logoff. Show all posts
Java Program to Hibernate Windows Operating System
Do you want to hibernate your Windows computer using java program? This is a java program to hibernate Windows operating System. If you execute this java program, it will hibernate your Windows computer instantly. The following is the java code to hibernate Windows:
How to Logoff or Sign Out Windows Using Java Code
You can sign out the current user account from windows using java code. Sign out, log out or logoff button can be created using simple lines of code. To logout from Windows operating system using java code, use the following code:
As the above code shows, we are simply executing a cmd command shutdown /l. It is actually running shutdown.exe with parameter /l to force logoff. If you add above code in the actionPerformed() function of a button, the button becomes a logoff button. The following video will show an example in which a simple button is made into a logout button.
try { Runtime.getRuntime().exec("shutdown /l"); } catch (IOException ex) {}
As the above code shows, we are simply executing a cmd command shutdown /l. It is actually running shutdown.exe with parameter /l to force logoff. If you add above code in the actionPerformed() function of a button, the button becomes a logoff button. The following video will show an example in which a simple button is made into a logout button.
Subscribe to:
Posts (Atom)