How to create your first Java program with BleuJ

  • On BlueJ's menu, click on New Project:

How to create your first Java program with BleuJ

  • You can pick your own folder (otherwise, BleuJ will uses its default folder):

    I chose to store my Java projects inside my C:\Java\BleuJ folder...

     

How to create your first Java program with BleuJ

  • Enter the name of your new project and click OK:

    I chose the name Hello

    BleuJ will create a new folder C:\Java\BleuJ\Hello for me.

How to create your first Java program with BleuJ

  • When you're done, you empty project will look like this:

    We can now write our Java program

    A Java program is always contained inside a (Java) class...

How to create your first Java program with BleuJ

  • To create a new class inside a project, click on New Class:

    A class is Java's container for program code and variables

     

How to create your first Java program with BleuJ

  • Choose a class name:

    I chose to call my class:   hello

    (You can use any name that you like; please pick a meaningful name)

How to create your first Java program with BleuJ

  • When you're done, you will see your new class in BlueJ:

    You can see that the class name is:   hello

    The class is shaded, meaning that it has not been compiled yet...

How to create your first Java program with BleuJ

  • To enter your Java program into a class, double click on the class:

    You will see an pre-filled Java program

    BleuJ is trying to save you some time by filling out the most commonly used things

How to create your first Java program with BleuJ

  • For this demo, you should delete everything first:

    And then enter the demo program

     

How to create your first Java program with BleuJ

  • Your program should look like this:

    Before you can run the program, you must first compile it....

     

How to create your first Java program with BleuJ

  • Click on compile to compile your program:

    Note that you may get errors when you compile....

    In that case, you must fix your error(s) and compile again !

How to create your first Java program with BleuJ

  • When the compilation is successful, the class will become unshaded:

    That means that you can run the methods (functions) inside that class !

    Let's run the main( ) method !

How to create your first Java program with BleuJ

  • Right click on the class and select the main( ) method:

    This means that you want to run the main( )methods (functions) inside the class..

    A window will pop up...

How to create your first Java program with BleuJ

  • Right click on the class and select the main( ) method:

    This means that you want to run the main( )methods (functions) inside the class..

    A window will pop up...

How to create your first Java program with BleuJ

  • You may enter some parameters to the main( ) function:

    For this demo, we will not use any parameters...

    We just click on OK...

How to create your first Java program with BleuJ

  • The Java program will run and you will see its output in a pop up window:

    That concludes the demo...