There's no way to calculate it, but you can certainly ask Windows what it is. There are multiple ugly ways you might do that. For example, on Windows XP Pro (and presumably some of your more Pro-life versions of Vista, as well) there's a program called "tasklist" which reports process info to standard output. You could run it with a Runtime.exec() call and extract the number(s) you want from the output.
You could also use JNI, the Java Native Interface, to call the appropriate Win32 function. You might be able to think of some even more hideous ways to do it.
Or you could use the right tool for the job, and use a Windows language like C#, C++, etc, to write the whole thing and talk to the API directly.
Abhijit: How can I use the JNI API to accomplish the task ?
JNI is just a way to call native programs from java. So, the assumption is that you have written something in C/C++ to talk to the api for getting CPU usage details. JNI will just help you to call this C/C++ program from Java and get the results. [ December 08, 2008: Message edited by: Nitesh Kant ]
I have come across API of JRobin to calculate the CPU load. It takes the support of NET-SMPT jars. But I cannot able to configure the SMPT. Resgistration and Start service are done . But the log files show it is not properly started. If any body use these two JARs to acomplish the CPU load, then please help to configure all.
While running the main function , Timeout exception is comming.