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 ?

6
  • What operating system are you using? In what application did you double-click the jar files? Commented May 2, 2015 at 10:05
  • windows 7, just on distributed jar Commented May 2, 2015 at 10:12
  • Well, you should see the corresponding java.exe process in the task manager, AFAICT. However, if you need to get the list in some programe, then you should enumerate these processes and system scripting facilities are quite limited under Windows. Commented May 2, 2015 at 10:15
  • can you give some code example please Commented May 2, 2015 at 10:25
  • Well, I dont have Window 7, sorry. Commented May 2, 2015 at 10:28

2 Answers 2

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:

Sign up to request clarification or add additional context in comments.

Comments

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:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.