Tutorial 3 - Creating a new project
1 2 3
4 5 6 7
This tutorial will cover the steps to create a new project, learn the different parts of the IDE, and learn how to edit code in Netbeans. We will code a simple Tutorial program to demonstrate this. The Tutorial program will be used for the remainder of the tutorials, so make sure you don't delete it once you are done with this tutorial.
Step 1: Create a new project
- Select File > New Project from the menu at the top
- At the New Project screen, select General for Category, Java Application for the Project and click the "Next" button
- Name the project "Tutorial" and choose a location for it. Leave Set as Main Project and Create Main Class checked.
- The Main Class will be your "Driver" class. Always make sure to rename it something that is not "Main". I prefer the name Driver.
- NOTE: In the textbox next to "Create Main Class", it should NEVER read something.Driver. This will put your files into a java package, which is not covered in this class. If your project name is Homework4 and your driver class is named Driver, the main class name should just be Driver, NOT homework4.Driver.
- When you are done, click the "Finish" button and move on to the next step.
Step 2: Parts of the IDE
- Below is a screenshot of the Project window. You can use this window to see all the files (classes) that make up your project.
- NOTE: For every project, all of your files should always be in <default package>. If they are in something else besides <default package>, you have made a mistake in step 1.
- Below is a screenshot of the Output window. This is the window you will look at when you try to compile and run your program. It will display the same output as what is displayed when you type "javac" and "java". Whenever you use the Scanner class, you can use this window for input as well.
- Below is the Code window. This is where you will edit all your source code. There are buttons at the top for adding comments, and doing other useful tasks.
Step 3: Print some numbers!
- Lets write a simple program that will just print out the numbers 1 to 5. See the screenshot below for the code snippet.
You can learn how to compile and run your program in the next tutorial.