Take the 2-minute tour ×

I would like to see what Eclipse executes on the command-line when launching my Java program. How can I access this?

For example, to run myClass.class, Eclipse will use something similar to this: java.exe -classpath "H:\Eclipse_workspace\Example1\bin;.... myClass.class. Is there a way to get this command?

share|improve this question
add comment

4 Answers

up vote 4 down vote accepted

You could use the RuntimeMXBean within the application that is launched by eclipse.

RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();
List<String> paramList=new ArrayList<String>();
paramList.addAll( RuntimemxBean.getInputArguments() );
paramList.add(  RuntimemxBean.getClassPath() );
paramList.add(  RuntimemxBean.getBootClassPath()  );
paramList.add(  RuntimemxBean.getLibraryPath()  );

for( String p : paramList ) {
    System.out.println( p ); 
share|improve this answer
Thanks, it's working perfectly fine ! –  scsin75 Aug 10 '10 at 0:28
add comment

If you're using a launch configuration, you can follow these steps to get the Java command executed by Eclipse to run your program with that configuration:

  1. Run the program with the specific launch configuration
    1. Right click the Main class
    2. Select Run As > Run Configurations...
    3. Setup the configuration to your needs
    4. Click apply and then run
  2. Switch to the Debug perspective (Window > Open Perspective > Debug)
  3. In Debug perspective, find the window pane titled Debug
  4. In the Debug window pane, find the line for the Virtual Machine
    enter image description here
  5. Right-click the Virtual Machine and select Properties
  6. In Process Properties there is the Command Line section which contains exactly the command that Eclipse used to run your program.
share|improve this answer
thanks, stupid question (just beginning with eclipse), where is the virtual machine line in the debug view ? –  scsin75 Aug 12 '10 at 12:16
@scsin75, in the Debug window there is a tree that shows your currently running app, with the continue, pause, stop, step over, step into etc buttons –  David d C e Freitas Sep 21 '12 at 12:02
+1, this is exactly how to get the (long) Java command used by Eclipse. –  jbranchaud Feb 22 '13 at 17:30
add comment

Depending on what you're seeking and when, you might find it sufficient to view the run configuration, accessible via Run>Run Configurations. It identifies what JRE is being used, the program and VM arguments, the classpath, and more.

share|improve this answer
add comment

It seems you are using Windows...

For Linux / Mac OS X, I use something like ps -x | grep java, this will show the complete command including class path and arguments, for instance.

share|improve this answer
You can actually see it in windows too: In process explorer you can add the column that shows the full path. –  David d C e Freitas Sep 21 '12 at 12:01
add comment

Your Answer


