You'd need to use an external (non-Java) program, or use JNI (Java Native Methods.) Java has no "what processes are running on this machine" API, nor any class that represents an externally-started process.
I agree with Ernest. But I have little Idea and not sure if it work. How about starting a process through Runtime class and run 'cmd' command for windows.
If we pass an OS command as an orgument to cmd command, will it not run the other command. I feel, is should. In that case we can capture the output and know the details of other process running by passing such command name as argument to Cmd command.
i want to check which application are running on windows machine using java.
I am with Earnest on this.
Even if you write a native program to identify the java applications among other applications running on the OS, how can you identify the java applications between themselves.
Suppose you write a native program called Applister which gets into the internals of OS and identifies the application. Your java apps may be started like this "java app1", java app2, java app3 where app1 is your class name. In this case AppLister knows three JVMs are running. But AppLister cannot know the class name (which is the application name) unless AppLister can probe into each JVM.
I am sure performance diagnosis folks normally use some similar tools like jprobe. If you post this in performance forum you will get some lead.
If we pass an OS command as an argument to cmd command, will it not run the other command. I feel, is should. In that case we can capture the output and know the details of other process running by passing such command name as argument to Cmd command.
This is rather like monitoring a room through a keyhole because you think opening the door is too obvious. You can do it, but it's hard to see why you would want.
If you're fond of three-legged races or passing eggs to others using only a spoon, I can imagine the appeal of this exercise. I just can't see the practical value.
Make visible what, without you, might perhaps never have been seen. - Robert Bresson
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees: