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

Creating a package

Everything is better when organized. With this in mind, we will check how to create packages using the IDE.

Besides being more organized, it is a bad coding practice to leave all classes in the same package or in the root package.

How to do it…

First, we will need to create a new project, so please refer to the recipes in Chapter 1, Using NetBeans Projects, for creating Java projects. When naming the project, enter CreatingPackages. When the Projects explorer shows the CreatingPackages project, expand the CreatingPackages node if not yet expanded. When creating the project, it is not necessary to create a main class.

Now, we will create a package for our source code with the following steps:

  1. Within the Projects explorer, expand the ...

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