Home | About | Categories | All Tips & Tutorials

Install Bluej on Ubuntu, Java Development Environment for beginners

ID: 293

Category: Java

Added: 19th of November 2021

Updated On: Tutorial updated and rechecked on 12th of July 2022

Views: 2,664



Click here to buy Java Books
Affiliate Link ⓘ




There are quite a few IDE's available to help you develop in Java. If your learning Java, Bluej is an excellent development environment for beginners.

Before installing Bluej in Ubuntu / Ubuntu based distribution, you need to make sure java is installed in your distribution.

Please visit the following tutorial which will show you how to install the various packages https://mycomputertips.co.uk/285 then return to this tutorial

Once installed, visit the Bluej website and download the latest .deb package for Ubuntu / Ubuntu based distributions. https://www.bluej.org/

Then issue the following command to install the package. I'm installing version BlueJ-linux-502 yours might be different
sudo dpkg -i BlueJ-linux-502.deb


Next create a folder on your Desktop named Bluej, this is where Bluej will save your project files



Start Bluej from your distribution. Once Bluej has loaded, click the New Project button



For the project name enter MyFirstJavaProgram, and select the Bluej folder on your desktop for the location



Next we need to create a new Class file. Click the New Class button and enter helloComputer for the Class name and then click OK




Right click on the helloComputer class file and select Open Editor from menu



Bluej will now open the code editor window.
The first thing to do is add some comments at the top of the page for author and version number.




Next we need to add some java code. I don't know why Bluej presents this code as I have learned a different approach, so highlight and remove the code between the braces in the helloComputer class




Now add the following method code inside the helloComputer class
public static void main (String[] args) {

System.out.println("Hello Computer");
}




Next save the code



We now need to compile the code. Click the Compile button



If there are no errors within your code, it will show Class compiled - no syntax errors at the bottom of the editor window. Click the close button to exit the editor



Now we need need to execute the code



Right click on the helloComputer class and select void main method from the select menu, and click OK




A new window will now open and display the output. Hello computer will be printed in the window.



In this tutorial we created a new project in Bluej. We then created a new class file, compiled and executed our first java program which printed Hello Computer in the console window. Hopefully this will give you a starting point to using Bluej, as you learn more about java like myself.

Related Tips & Tutorials

How to compile your Java code using the terminal in Linux, Learning Java

Printing to console in Java using the System.out.println command

Reading user input and outputting the results to console in Java using Scanner class

Simple for loop in Java. Print the numbers 1 to 10 in the console