I have several JUnit run configurations in Eclipse that I need to replicate on the command-line in order to use a third-party analysis tool. So far I've just been writing the command-line manually by looking at the run configuration and writing the appropriate classpath and command-line arguments.
Eclipse's run configurations (normal, JUnit, or other) must ultimately boil down to a command-line anyway, so how and where do I find that?
A fully working command-line Terminal inside Eclipse. Just press Ctrl+Alt+T to open a local command prompt (Terminal).
Creating and Using a Run Configuration The Run Configuration dialog can be invoked by selecting the Run Configurations menu item from the Run menu. A name for the run configuration.
In the Eclipse menu bar, click Run > Run Configurations. In the Run Configurations dialog box, click Java Application in the left pane. Click the New launch configuration icon in the left upper corner. By default, Eclipse names the run configuration after the name of your Java class.
In Eclipse, select File → Export, then Java → Runnable JAR File. Launch Configuration identifies which program should be exported. Find the one that runs the class containing your main() method. Export Destination is the name and location of the JAR file you want to generate.
I found a solution on Stack Overflow for Java program run configurations which also works for JUnit run configurations.
You can get the full command executed by your configuration on the Debug tab, or more specifically the Debug view.
- Run your application
- Go to your Debug perspective
- There should be an entry in there (in the Debug View) for the app you've just executed
- Right-click the node which references java.exe or javaw.exe and select Properties In the dialog that pops up you'll see the Command Line which includes all jars, parameters, etc
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