Which tools can I use to know the life-time or run-time of a program(from the beginning until the program ends)? I also want to know how much memory that program consumes from start to end. The program is written in Java and I'm running it on Windows XP.
"How much time" a program takes is a tricky question, and the answer varies tremendously depending on the state of OS disk caches, and whether you include the start-up time of the JVM itself, etc.
The other part of your question is much easier to answer: you need a profiler. A profiler will not only tell you gross memory statistics (or gross runtime), but will allow you to pinpoint the trouble spots in your programs, areas that create an inordinate number of objects per unit time, or places that burn a lot of CPU relative to other places in your code.
If you're interested in monitoring, you may use jconsole
which is part of the JDK. Otherwise, please elaborate on your question.
You can try monitoring your application with the jconsole tool that ships with the JDK now. If that isn't enough, I'd try profiling your application with something like YourKit. Its a commercial product but extremely useful.
I understand that NetBeans has a profiler built in but I have not used it. If you're using NetBeans, that might be an option as well.
If you were using *nix you could use the 'time' command. For Windows see this other SO thread
I use VisualVM from Sun, and its very good, with lots of useful features. You can monitor Heap Space usage, Loaded Classes, GC Activity and Live Threads.
You can also do the same for remote Java applications.