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?
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:
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 );
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With