Whenever you're learning a new programming language, it's easy to criticize all the boilerplate text you need to memorize. Before you can get comfortable starting a project, you have to remember the preambles that, in theory, ought to be easy to remember since they're usually relatively short and repetitive. In practice, though, boilerplate text is too obscure in meaning to become an easy habit, but it's essential for a program to run.
Sometimes the text is just one line. For example, a shell script opens with a simple "shebang":
#!/bin/sh
Other times, the introductory text is more complex. For instance, a Java class often looks something like this:
import java.io.Foo;
public class Main {
public static void main(String[] args) {}
// some code here
}
The University of Kent is sensitive to this beginner-level struggle, so it develops and maintains BlueJ, an open source integrated development environment (IDE) for Java learners.
BlueJ templates
BlueJ's interface is clean and simple, with just four items in its main menu bar. As you build a project, you see a "mind map" or flowchart of how your Java files fit together.
When you create a new class, BlueJ generates a clean but robust template with hints toward what you need to do. It uses a subdued color scheme to keep different code elements separate from one another, so it's easy to tell a class from a method or a comment.
How BlueJ helps you learn Java
If you're new to programming—or just new to Java, it can be difficult to understand advanced concepts like variable scoping and loops and conditionals. It doesn't help that when you're learning to program, most of the code you type looks and feels basically the same: it's all vaguely meaningful, yet oddly similar, with words that seem to make as much sense whether you read them backward or forward. It can be nearly impossible to tell a variable apart from a keyword that's a part of the language, and even with the assistance of indentation and braces and semicolons, it all starts to blur together.
BlueJ is designed to clear away this confusion. By using colored backgrounds, BlueJ helps you visualize the structure of the code you're writing. You don't have to rely on indentation to see that a Java method falls within a specific class because you can see the blocks of code.
More importantly, BlueJ helps you trace errors back to their cause.
For instance, if you define a variable called foo inside an if statement, and then refer to foo outside that statement, BlueJ correctly alerts you there is an error. It doesn't tell you how to fix the error, and it doesn't offer to correct it for you, but it does make you wonder why the error exists.
There are plenty of hints in the visual layout, and should you realize, through research or a sudden flash of inspiration, that your foo variable is "trapped" inside the if loop's scope, you can make adjustments.
BlueJ isn't an all-purpose IDE. It's very much a learning tool, and it's purposefully less helpful than a full IDE like Eclipse or NetBeans. It's meant to help you learn the language, not to type faster or more efficiently.
Installing BlueJ
BlueJ is written in Java, so to run it, you must install Java. You need Java to program in the language anyway, so you may already have Java installed. However, to use BlueJ, you must have the same version of Java used by BlueJ, so check the version you have against what BlueJ requires. BlueJ also requires JavaFX (as a separate download), so follow the instructions on the BlueJ site. After you've installed Java and JavaFX, launch the BlueJ installer.
BlueJ has downloadable installers for Ubuntu Linux, Windows, and macOS. It also offers a "generic" installer, delivered as a JAR file (the usual Java format). If you're using the generic installer, launch it with Java from a terminal:
$ java -jar ./BlueJ*jar
Once it launches, point it to the directory you want to use for installing. I suggest using the $HOME/.local/bin directory, if it exists, because that's generally in your path.
Once it's installed, you can launch it from a terminal:
$ bluej
Or you can create a .desktop file so it shows up in your applications menu. This .desktop file is all you need:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=BlueJ
Comment=A simple powerful Java IDE
Categories=Application;Development;
Exec=~/.local/bin/bluej/bluej
Icon=~/.local/bin/bluej/icons/bluej-icon-512-embossed.png
Terminal=false
Type=Application
Save the file as bluej.desktop to ~/.local/share/applications, and soon BlueJ will show up in your application menu.
Painless Java
Java is a robust language with many serious fans and a staggering variety of applications to its credit—including tabletop gaming utilities, XML processors, PDF generators, and music applications. BlueJ aims to make Java easy to learn, regardless of whether you're an experienced programmer or still struggling with your first "hello world." Install it today and get started on an exciting cross-platform programming adventure!
1 Comment