How to Run Source Code
When creating a software application, compiling the entire project as an executable file can take a while. Depending on the size of your application and the speed of your computer, compiling an application could take a few seconds or many hours. Therefore, compiling an application just to test or debug certain parts of your source code slows the development process considerably. Fortunately, most programming environments provide a way to test or run your code, directly from the coding application, with a single keystroke.
Open the programming application or software development kit used to create the code you want to test or run.
Click "File," then "Open" or "Open Project" on the menu bar. Browse to the source file for the project. If created in a programming or development application, the source code is usually inside a proprietary file format used by the program. However, if you copied and pasted code into Notepad or text document, most development applications can open these types of files as well.
Click and select the "Class," "Event" or "Module" in the source file that contains a snippet or section of code you want to test. If you want to run all the code in the source file or are opening code contained in a text document, skip this step.
Press the "F5" key on the keyboard. The programming application loads and creates a temporary compilation of the code and executes the included commands. If no errors are present in the code, the code performs as expected. However, if the code contains syntax or variable errors, the application usually displays an error window displaying the offending code and its line number.
Make variable or syntax changes to the code as needed, and then save the changes. Press the "F5" key again to test the source code with the changes.
Tips & Warnings
- Most application development programs or SDK support the "F5" run or execute command. If the "F5" key does not work in your environment, refer to the documentation for the SDK or click the "Help" link on the menu bar to find out which function key initiates runtime execution of code loaded in the editor window.