This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes Windows 2000 Plateform... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Windows 2000 Plateform..." Watch "Windows 2000 Plateform..." New topic

Windows 2000 Plateform...

Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
Hi all,

Can anyone please explain how to shutdown windows 2000 using java program. Well on MSDN I found one method which can shutdown windows.

DWORD WINAPI InitiateShutdown(
LPTSTR lpMachineName,
LPTSTR lpMessage ,
DWORD dwGracePeriod,
DWORD dwShutdownFlags,
DWORD dwReason

Is there any dll file available for this. I found one dll file csWindowsShutdown.dll. When I load this dll, then runtime system throws an Error says mscoree.dll not found.

Is there any alternate way of doing this?

Thanks & Regards


Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
Windows has a SHUTDOWN command, which you can execute using Runtime.exec.
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
Thanks Ulf...

It worked as you have explained.

java Shutdown shutdown /L /T:10

This shutdown my computer in 10 seconds.

Thanks once again


Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15037

If you look at the description in the Windows API reference on MSDN, it tells you in which DLL this function is: advapi32.dll.

Note that the description also says Requires Windows Vista / Requires Windows Server "Longhorn", so this is most likely not going to work on Windows 2000 anyway. You should use the function ExitWindowsEx instead.

See also: Shutting Down on MSDN.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: Windows 2000 Plateform...
It's not a secret anymore!