View on GitHub

CS173

Intro to Computer Science

CS173: Intro to Computer Science - NetBeans Software Environment

This guide has been adapted from Professor Tralie.

Software Environment

We will be using the Java programming language in this class. The purpose of the class is not to become an expert in Java, but rather to use Java in the service of learning about other topics in computer science. To make this as easy as possible, we will start with an Integrated Development Environment (IDE) known as Neatbeans, which will make it easy to organize your projects and to run the code you write. It also has some nice tools to help you debug.

Please visit these links to install the Java Development Kit (JDK) and NetBeans. You will install the JDK first, and then NetBeans. Most Windows and Linux users will want the x64 downloads for each of these.

Here are a few notes to help you:

NOTE: You may also use Eclipse, IntelliJ Idea, or the terminal (javac and java) if you are more comfortable with them, but the default option is Netbeans, and we will be working through examples in class and in labs with Netbeans. Also, there is a combined download of Java and NetBeans in a single installer. You are welcome to use this, but it is an older version of the software, so things might look a little different from the examples in class.

Instructions for Creating NetBeans Projects

To create a new project, first select File->New Project

Then, select the projcet type “Java Application” under the “Java with Ant” section, and click Next

Choose a location and a name for the project. You can uncheck the “Create Main Class” box unless, you want a file with an automatically generated file that runs when you click the play button for this project. But we’re going to start from scratch in this example without a main

When you create a new project for the first time, NetBeans may prompt you to complete the installation of some software or to “resolve the project” (which configures it to run on your computer). This is a one-time occurrence, if you even see this at all, and you can allow it to do so if asked.

Once the project has been created, you can make a new class by right clicking on default projects and clicking New->Java Class. This will create a new Java file with the name of the class you’ve chosen

Starting a new class like this without a package that you’ve chosen will create a completely empty class definition. We have to add some methods to it ourselves, including a main if we want it to do something when we right click on it and type “run.” For now, we’ll add a public static method that returns true if an integer is even and false otherwise:

Good Coding Style, Testing, Debugging, and Exporting Your Projects

We will use these tools later in the semester, so you can skip them the first time you’re installing the software. However, I’ll include some guides here for when the time comes.

Writing with Good Coding Style with Help from the CheckStyle NetBeans Plugin

Significant emphasis is placed upon good coding style as we introduce the fundamental concepts of software development. Here is an article on using CheckStyle, a plugin that will automatically scan your code as you write it and make recommendations about how to improve the quality of your code.

Writing Test Cases

An important aspect of writing software is testing our code. We will learn to do this during the class, and use the integrated unit test software built into Java and NetBeans. Here is an article on using JUnit, the unit testing framework.

Using the Debugger

In addition to testing, NetBeans includes a debugger that can help identify errors in your code (especially when a test case fails!). Here is an article on using the NetBeans debugger for your projects.

Exporting To Zip

If you want to export your whole project to a zip, go to File->Export Project->To ZIP

Save your file with a .zip extension (that is, MyProject.zip). You can click Browse on the export dialog to choose a location like your Desktop.

Apporto

The NetBeans IDE software is also installed on Apporto, which can be reached from the cloud. Here are instructions on how to access the software through Apporto.