Your First Java Project in BlueJ: Create, Compile and Run a Program
Create your first Java program in BlueJ step by step: make a project, add a class, write and compile the code, run main(), and create an object from the class – the essential first lesson for ICSE Class 9 Computer Applications.

Once BlueJ is installed, the next step is to write, compile and run your first Java program. This lesson walks you through the whole process. It is the same routine you will use for every program in ICSE Computer Applications and ISC Computer Science.
Step 1: Create a new project
- Open BlueJ and click Project → New Project.
- Choose a folder (for example
Documents), type the project nameMyFirstProject, and click Create.
A project is simply a folder that holds all your classes.
Step 2: Create a class
- Click the New Class button on the left.
- Type the class name
Hello. Class names start with a capital letter by convention. - Keep the type as Class and click OK.
An orange box labelled Hello appears. The stripes on it mean the class has not been compiled yet.
Step 3: Write the code
Double-click the Hello box to open the editor. Delete the sample code BlueJ inserts and type:
public class Hello {
public static void main(String args[]) {
System.out.println("Hello, Java4School!");
System.out.println("My first Java program in BlueJ.");
}
}Step 4: Compile
Click Compile in the editor window, or press Ctrl + K.
- If the message at the bottom reads "Class compiled – no syntax errors", you are ready to run.
- If there is an error, BlueJ highlights the line. The most common first-day mistakes are a missing semicolon
;, a missing closing bracket}, and typingsysteminstead ofSystem. Java is case-sensitive.
Step 5: Run the program
- Close the editor and right-click the
Hellobox. - Choose void main(String[] args) and click OK in the dialog that opens.
- The Terminal Window opens and shows:
Hello, Java4School!
My first Java program in BlueJ.Congratulations, you have run your first Java program!
Step 6: Create an object (the BlueJ way)
BlueJ lets you create objects without writing extra code, which is a great way to understand classes and objects. Add a second class:
public class Student {
String name = "Riya";
int marks = 95;
void display() {
System.out.println(name + " scored " + marks);
}
}Compile it, then right-click Student and choose new Student(). A red box appears in the object bench at the bottom. That is your object. Right-click the object and choose display(). The terminal prints Riya scored 95.
Key terms from this lesson
- Source code: the Java program you type, saved in a file such as
Hello.java. - Compiling: converting source code into bytecode (
Hello.class), which the Java Virtual Machine (JVM) runs. - main() method: the starting point of a Java program.
- Object bench: the area in BlueJ where the objects you create are shown.
What next?
Learn how to take input from the user with the Scanner class and BufferedReader, then practise with our ICSE Class 9 solved programs.
Related Posts
Continue learning with these related articles

ICSE Class 10 Computer Applications Model Papers with Java Programs
Two ICSE Class 10 Computer Applications model examination papers with Java programming questions on wrapper classes, arrays, searching, sorting and strings, plus a programming class test with a solved example. Free PDF download.

7 ICSE Class 10 Computer Applications MCQ Model Papers (Free PDF)
Seven ICSE Class 10 Computer Applications model papers and practice tests in MCQ format, covering Java basics, operators, loops, strings, arrays, constructors and output questions, plus a fill-in-the-blanks program test. Free PDF downloads with worked examples.

ICSE Class 10 Computer Applications Pre-board Papers 1 and 2 (MCQ)
Two full ICSE Class 10 Computer Applications pre-board papers (50 marks, MCQ format) prepared by Trushna Tejwani, with worked examples on data types, loops, type casting, operators and constructors. Free PDF download.