Book Image

NetBeans IDE 7 Cookbook

By : Rhawi Dantas
Book Image

NetBeans IDE 7 Cookbook

By: Rhawi Dantas

Overview of this book

<p>Java IDEs have grown bigger and more complicated with time. Some development environments even require the user to spend countless hours searching for more software to bundle with the IDE just to start working. NetBeans abstracts much of the work needed to configure the environment and makes it convenient for Java developers to start coding straight away. With this book in hand you will tap into the endless possibilities of developing modern desktop and web applications in Java.<br /><br />NetBeans IDE 7 Cookbook is perfect for you if you are ready to take the next step from the standard tutorials and move into the practical world. It will show you all the features of the NetBeans IDE used by Java developers. It goes to great lengths in explaining different ways of achieving a desired goal and uncovering features present in NetBeans that are often overlooked or forgotten.<br /><br />The NetBeans IDE 7 Cookbook will appeal to Java programmers at all levels who are ready to go beyond just tutorials.</p>
Table of Contents (19 chapters)
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Running the main class


It is possible to compile and run the main class straight from NetBeans IDE. The primary reason for executing the main class is fairly obvious, that is, to test that modifications made in the software are actually what the coder(s) intended.

How to do it...

It is necessary to have a project in order to create a class, so if you are unsure how to do this, please check the Creating a Java project using Wizard recipe. However, when naming the project, enter RunMainClassApp .

With the main class open, enter the following line of code inside of the main() method:

System.out.println("Main class output");

Then right-click inside the Java editor of the Main.java file and select Run File.

How it works...

NetBeans will always show the Run File option for a Java class that contains the main method.

After Run File is selected, NetBeans will then compile and execute it. The output, if any, of the main class will be shown in the Output view.

For this example, the output is: Main class output...