Java IDEs
Basic Java Program
Use this basic program in each IDE below.
public class HelloWorld {
public static void main(String[] args) {
String name = "Mira";
System.out.println("Hello, " + name);
}
}Output:
Hello, MiraCreate and Run the Program in Different IDEs
Use the HelloWorld program above in each IDE. Install a JDK before starting. The menu names may vary slightly between versions.
IntelliJ IDEA
- Open IntelliJ IDEA and select New Project.
- Select Java, enter
JavaPracticeas the project name, and choose an installed JDK. Use the IntelliJ build system for this basic example. - Create the project. In the project panel, right-click the
srcfolder and select New > Java Class. - Enter
HelloWorldas the class name. Replace the generated class with the program above. - Click the run icon beside
mainand select Run 'HelloWorld.main()'. - Check the Run window. It should display
Hello, Mira.
See the IntelliJ IDEA Java guide for the project options in your version.
Eclipse IDE
- Open Eclipse and choose a workspace folder. This folder holds your projects.
- Select File > New > Java Project. Enter
JavaPractice, choose the installed JDK, and finish creating the project. If asked to createmodule-info.java, select Don't Create for this example. - Right-click the project's
srcfolder and select New > Class. - Enter
HelloWorldas the class name. Keep the package field empty for this small example, then click Finish. - Replace the generated class with the program above.
- Right-click
HelloWorld.javaand select Run As > Java Application. The Console should displayHello, Mira.
See the Eclipse Java project guide for more setup details.
Apache NetBeans
- Open NetBeans and select File > New Project.
- Choose Java with Maven > Java Application and click Next.
- Enter
JavaPracticeas the project name, complete the required project details, and click Finish. - Under Source Packages, right-click the generated package and select New > Java Class. Name the class
HelloWorld. - Keep the generated
packageline at the top. Place theHelloWorldclass from the example below that line, replacing the generated class. - Right-click
HelloWorld.javaand select Run File. The Output window should displayHello, Mira.
The first Maven build may download the tools it needs. See the NetBeans Java quick start for project creation details.
Visual Studio Code
- Install Extension Pack for Java in VS Code and make sure a JDK is installed.
- Open the Command Palette and select Java: Create Java Project.
- Choose No build tools, select a folder, and enter
JavaPracticeas the project name. - In the
srcfolder, createHelloWorld.javaand add the program above. - Click Run above the
mainmethod. - Check the terminal for
Hello, Mira.
See the VS Code Java project guide for the Java project commands.
See you in next page....🙂