Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I click on a java app's icon, and the app starts normally. How can I find out the path to the java executable that is running the app?

Better yet, is there a way to find the exact command-line invocation of java that would have the same effect as double-clicking on the icon? (Note: I'm aware of open -a, and it is definitely not what I'm asking about here. The command-line invocation I'm interested in should begin with java ..., specify a classpath, etc.)

share|improve this question

Run your app, open a terminal, and try:

ps -awwx  -o command | grep java

ps, very wide, print the full command line, and look for java.

If you don't see the classpath, it may be passed in your environment variables, in that case, you may need to add the -E flag to ps. At this point, its messy, and you probably want to redirect to a file.

share|improve this answer

You could also run which -a java which will list all java executables found in your $PATH.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .