Creating a Project
Adding a New Class to a Project
To add a new class to your project, you can either use the New Class button or move to the edit button on the menu and then select a new class. Clicking any of these buttons will open a new class dialog box. Proceed to enter the name of your class and select Java as the programming language. The class type should be "class" and then click on ok. You have already created a new class. For example, if you named your class HelloJava, you should be able to see it in the project's folder. You will also notice that it has a .java extension which all source files should have.
Compiling Your Java Code in BlueJ
BlueJ has the compile button that can be used to compile the code of your class. The other method that you can use is right-clicking the class icon in the project window and choosing compile. Both ways are accepted and you can choose the one that suits you. If you successfully compile a class, you will notice that the stripes on the icon will be gone. For our HelloJava class, a file helloJava.class will be generated by the Java compiler. The file is the bytecode of the class and is executed by the Java Virtual Machine when we run our program.