Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.