View Table of Contents | JavaForHumans by Lincoln W Daniel | Subscribe to ModernNerd on Youtube for Coding Videos

Installing NetBeans + Java JDK & Running Your First Java Program on Windows 10 [17 Gifs]

Lincoln W Daniel
Feb 1, 2016 · 7 min read

In order to begin programming in Java, you need an IDE. Lucky for us, Oracle, the maintainers of Java, provides a free and easy to use IDE called NetBeans. Along with an IDE, we need the Java programming language installed on our computers if we want to program in Java. Thus, we need to download both NetBeans and the latest Java Development Kit (JDK) from Oracle’s website.

Today, we will download the NetBeans + JDK Bundle and compile and execute our first Java program, “Hello, World” in NetBeans. Follow the gifs below and you’ll be on your way. While this tutorial is specifically for Windows 10, the steps are practically identical on Windows 8.

  1. Open up your web browser and navigate to Google.

Downloading NetBeans 8.1 IDE + JDK 1.8 Bundle

2. Search “java jdk,” and click the “NetBeans + JDK Bundle” link from Oracle.

3. You must accept the license agreements before you can download the bundle. Click the download link corresponding to Windows x64 at the bottom of the table.

Save the download somewhere you can find it: your Downloads or Desktop folder should do.

4. Run the “jdk-8u71-nb-8_1-windows-x64” executable file that you downloaded. If a window pops up asking for permission or to grant the application make changes to your computer, click “Yes” .

The installation wizard will run.

Installing NetBeans & Java

5. Don’t make any changes to the preset field values. Just keep track of where the files are going to be installed by the wizard.

Keep clicking “Next”until it says “Install”. Click “Install” and wait for the wizard to do all of its magic to install Java 1.8 and NetBeans onto your computer.

6. When the wizard is done, click finish or close to exit and finish installation. Now you should see a blue “NetBeans IDE” icon on your desktop. Don’t click it yet. We need to set some environment variables before moving on.

Setting Environment Variables

7. Open your system’s Settings. Search for “environment variables” and click “edit the system’s environment variables.” A window called “System Properties” should pop up.

8. Click the “Environment Variables” button at the bottom on the System Properties window. Another window will pop up.

In the middle of the “Environment Variables” window, you should see a section called “System Variables”. In the System Variables list, find “Path” and double click it. Another window, “Edit environment variable” should pop up. Keep it open.

9. We need to add two new system variable that will tell the computer where it can find the Java jdk and jre. Both of these are needed to run Java on your system. Open your File Explorer and navigate as follows to find the path to jdk and jre:

This PC > OS (C:) > Program Files > Java

Note: If its not in Program Files, it may be in Program Files (x86)

10. First, we will add the path to the jdk1.8.0_71 by copying the path to its “bin” folder which has the executable Java program, “java.exe”. We will copy that path to add it to the System Variables’ Path list. Let’s copy it first:

11. Now, let’s go back to the “Edit environment variable” window from earlier. We need to click “New” to add a new path to our “Path” system variable. Click new and paste the path to the jdk’s bin folder we copied above:

12. Let’s repeat the last two steps to add the path to the jre’s bin folder. After you add the path to the jre’s bin folder, click “OK” at the bottom of the window to close the window.

13. Click “OK” in the other two windows to finish editing the system’s environment variables. We are now ready to run NetBeans.

Running Your First Java Program in NetBeans

14. That’s it for installation! All we have to do now is run NetBeans and begin coding. Let’s open NetBeans and start the process of creating a new project.

When NetBeans opens, in the top toolbar, click “File” and then select “New Project” at the top of the drop-down menu:

15. Let’s create our new Java project. Notice that there are many categories and project types. All we care about is Java and Java Project.

In the middle of the “New Project” window, you should see “Categories” to the left and “Projects” to the right. Select “Java” in Categories and select “Java Application” in Projects and click “Next” at the bottom:

16. At the top of the “New Java Application” window, change your project’s name to “HelloWorld”. This is the traditional name of the first project you run in any programming language. Also, make sure “Create Main Class” is checked and “Use Dedicated Folder for Storing Libraries” is unchecked. Click finish to move on:

A Main class in Java is simply a class with a main method. The main method is used by the compiler to run your program. Without it, your program will not run. Only one Main class is required in your project. Having more is usually unnecessary.

17. You should now see our HelloWorld project open in the left sidebar and our HelloWorld main class open to the right. Let’s add a simple line of code in our main method to print “Hello, world!” to the console:

In all caps, that line reads like so: SYSTEM.OUT.PRINTLN(“HELLO, WORLD!”);

It should not be in all caps, but it’s important you type it correctly, letter for letter. Write it just as you see it in the gif: System.out.println(“Hello, World!”);

Notice that to run our program, we had to click the green arrow in the top of the NetBeans window. At that point, our source code is compiled and “Hello, world” is successfully printed to the console in the bottom of the window.

Conclusion

Great work! You now know how to install Java 1.8, NetBeans, 8.1, and run a Java program in the NetBeans IDE. Now, its time to learn how to build more fun and useful programs in Java.

Java for Humans Beginners Book

Head over to JavaForHumans.com or the ModernNerd publication on Medium to read my beginners book on programming in Java. Java for Humans is a short book that teaches Java programming concepts in human relatable ways.

With a focus on beginners, Java for Humans aims to help anyone become a skilled Java programmer.


ModernNerd Code

Learn to Code Life. Subscribe to Video Tutorials on Youtube

Lincoln W Daniel

Written by

My passion is in developing software to enable people to accomplish their goals more efficiently. Author @JavaForHumans.com. Creator of @Smedian.com

ModernNerd Code

Learn to Code Life. Subscribe to Video Tutorials on Youtube

More From Medium

More on Coding from ModernNerd Code

More on Coding from ModernNerd Code

How to use Variables in JavaScript [Video]

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade