CIT-260: Creating, Compiling and Running Java Programs


In this lab, you will be required to create a Java application, then compile it and execute it. Before doing your assignment, you must download and install the Java Development Kit and NetBeans onto your computer. If you have not already done this, instructions are located here.

Follow the instructions in this lab carefully. You will use this same procedure for every programming project that you do in this course, so learn how to do it correctly now! Programs that are incorrectly compiled, or incorrectly submitted will not receive full credit when they are graded.

Summary of Important Concepts

Using the code editor included in NetBeans you will create your first Java program. The code that you create is called source code. NetBeans will save your source code in a file with the file extension .java. Source code contains statements written in the Java language. Before creating any project you should create a folder where you will store all of the files for the assignments you will do in this class. I suggest you create a folder called CIT-260 Assignments.

In order to create an executable file, you must compile your source code. NetBeans uses the compiler that is included in Java Development Kit. The compiler creates a file with the file extension .class. This is an intermediate language file that can now be executed on the Java Virtual Machine. When you run the program, the executable is loaded into the computer's memory along with the Java runtime environment and the computer starts executing by calling the method named Main( ). This process is illustrated below.

The compile process