In this article, let's review how to setup and use IntelliJ IDEA.
To install IntelliJ IDEA Community Edition, launch Haiku Depot and search for "IntelliJ" :
Proceed with the installation.
IntelliJ IDEA is proposed by JetBrains, so if you already read PyCharm Community Edition, you will notice that the GUI is quite similar :)
Launch the program via the applications menu :
The version available on Haiku is from 2023 :
The first time the application is opened, the below welcome screen is displayed :
Click on "New Project" and indicate "HelloHaiku" as the project's name :
You should see the below program generated :
Quite simple ?
Let's run it via the Run button :
As you can see, this default program will print a welcome message in the console with an incrementing variable :
In case you need to debug your programs, as for PyCharm, it's possible via the Debug button :
The breakpoint in red will hold the execution, waiting for your action :
You can step over / step in as per standard debugging features :
And the current executed line will be visible with the blue color :
If you don't need anymore a breakpoint, you can delete it, or - like below - unable it :
If it's unable, it will be displayed as an empty red circle (instead of a full red circle):
The IDE can also let you evaluation any expression, like the "i" variable below :
And the result will give its current value :
In case you need to evaluate a specific expression or variable, you can add it to the watches like below :
Here the "args" variable has been added, so each time you launch a debug, its value will be displayed:
IntelliJ is also proposing code completion as per the possible methods on the frame class displayed below:
The code refactoring is also possible (like renaming a variable or a class) :
One last point :
If having a menu icon displayed instead of a full menu on the top bar is disturbing you, can can add it again via the "Show main menu in separate toolbar" menu.
Ok let's write a simple Hello World application with the Swing GUI.
For that, create a new project named "HelloHaikuSwing" :
The default program below is created :
Replace the code by the below which is using the Swing API :
import javax.swing.*;
public class Main {
public static void main(String[] args) {
JFrame frame = new JFrame("HelloHaikuSwing");
JLabel label = new JLabel("Hello, World from Haiku!", SwingConstants.CENTER);
frame.add(label);
frame.setSize(400, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
Now run it :
Great !
A nice Swing java application is displaying an Hello World message :)
If you would like to investigate more on using Java on Haiku, you can check the plugins listed in the settings :
I didn't test any of them, but you can try if you are interested.
You can also check the resources available on the official JetBrains website : https://www.jetbrains.com/idea/resources/