Once we have created some code as a part of our application, the next stage is to run the code. NetBeans allows developers to run either a file (with a
main method) or a project. In this recipe, we'll see how this can be achieved.
It is necessary to have a project in order to run a file. If you are unsure on how to create a project, please check the recipes in Chapter 1, Using NetBeans Projects. To help follow this recipe, when creating a project, enter
RunningFiles as the project name and ensure that the Create Main Class option called
com.davidsalter.cookbook.runningfiles.RunningFiles is selected.
RunningFilesproject, and select New and Java Class….