How to Write Your First Java Program

Introduction: How to Write Your First Java Program

This tutorial shows you how to write your first Java program step by step.

Supplies

Computer

Internet Connection

Step 1: Download the Java JDK

Go to https://www.oracle.com/java/technologies/javase-jdk13-downloads.html and click the link that matches the machine you are using. Then, accept the license agreement.

Step 2: Download Eclipse

Go to https://www.eclipse.org/downloads/ and click on the circled buttons to start the download. When the download is complete, click "run". The eclipse installer will start.

Eclipse is used to write programs in an integrated environment that is easy to use.

Step 3: Launch Eclipse

Launch eclipse and select "Eclipse IDE for Java Developers". Then select where you want your projects to be stored on your computer. The default option is suitable for this tutorial.

Step 4: Setting Up Your Project

Go to file->new->Java Project and name your project.

You do not need to designate a package name.

Click finish.

If Eclipse prompts your for "Module-info" click "dont create".

Next, right click on the "src" folder and click "new"->"class".

Name the file "HelloWorld" and check the boxes "public static void main (String[] args)" and "Generate Comments"

Click finish.

Step 5: Writing and Running the Program

type "System.out.println("Hello World!");" between the curly braces of "public static void main(String[] args)".

Then click the green "run" button on the top left of the screen.

You should see the output of your program on the bottom of the screen.

Congratulations! You wrote your first program!

Next stop, Google!

Be the First to Share

    Recommendations

    • Fandom Contest

      Fandom Contest
    • Maps Challenge

      Maps Challenge
    • Summer Fun: Student Design Challenge

      Summer Fun: Student Design Challenge

    Comments