How to Write Your First Java Program
by pemorr in Design > Software
451 Views, 2 Favorites, 0 Comments
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
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.
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.
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.
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.
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!