0

I have a jar named helloDemo. I have double clicked on the jar file to run, assume it is running now. Now in another program I want to get all the jar file names and print them which are currently running or active in my system (windows7). Is there any way to do it ? I have goggled for it but no luck. Can anybody please help me on this ?

NiziL
  • 5,068
  • 23
  • 33
Sumon Bappi
  • 1,937
  • 8
  • 38
  • 82

2 Answers2

1

You can list all Java processes on the local machine or a remote machine with using Java Virtual Machine Process Status Tool - jps:

jps [options] [hostid]

  • options - list of options
  • hostid - host identifier of the remote machine.

For more information:

0

I assume you have successfully created a runnable jar, and not a simple archive, (if you're not sure about that, this question might be helpful: How to make an executable jar file) and HelloDemo.java looks like the further code (or something more elaborate) to ensure it will run a long time.

public class HelloDemo {
  public static void main(String[] args){
    while(true);
  }
}

Ok, this one runs a very long time ;P

So, you're able to launch a bunch of java process, and now want to list them. Well, stackoverflow is all you need:

Community
  • 1
  • 1
NiziL
  • 5,068
  • 23
  • 33