O'Reilly logo

NetBeans IDE 8 Cookbook by Rhawi Dantas, David Salter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running a file

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.

Getting ready

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.

How to do it…

  1. Right-click on the RunningFiles project, and select New and Java Class….
  2. On the New Java Class window, type ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required