You can create launchers so you can easily run your project from the project context menu with different arguments, for example, or launch it from a script. Normally when you run your application from the IDE, the executable specified in the project properties as the Run command is executed. If you create launchers, you can specify multiple commands to run. Right-click the project and select Run As > launcher-name to run them.
You can use the same launchers for debugging by right-clicking the project and selecting Debug As > launcher-name.
To create a launcher:
For the IDE's C/C++ sample application called Arguments, you could add the following to your launcher.properties file:
launcher1.runCommand="${OUTPUT_PATH}" "arg 1" "arg 2" "arg 3" "arg 4" launcher1.displayName=Four Args launcher2.runCommand=../dist/Debug/OracleSolarisStudio-Solaris-x86/arguments_1 "arg 1" launcher2.displayName=One Arg launcher3.runCommand=/bin/sh runMyProgram.sh
With this launcher.properties file, you would then be able to run the project using Run As > Four Args and Run As > One Arg or Run As > /bin/sh runMyProgram.sh.
The file runMyProgram.sh might be a script that sets environment variables for example, or does anything you want.
If you want to debug your application using a launcher that runs a script, you must also specify the option symbolFiles for that launcher so the debugger can debug the application instead of the shell used to run the script. For the launcher3 example above, this option could be added as follows:
launcher3.runCommand=/bin/sh runMyProgram.sh launcher3.symbolFiles=${LINKER_OUTPUT}
See also | |
---|---|
About C and C++ Projects |