Java, developed by Oracle, is possibly the most widely-applied, open-source programming language on Earth. Therefore, whether you are studying software development as a professional or a hobbyist, learning to program Java code can be valuable. To develop Java applications, you need two separate packages of Java-programming tools:
- A Java development kit (JDK)
- An integrated development environment (IDE) for Java, such as NetBeans, Eclipse or IntelliJ
Oracle distributes a convenient Java software bundle that contains both JDK 8 for the Java Standard Edition (SE) and NetBeans 8.0. This document can help you download and install a Java bundle, and then create your first Java application.
Downloading a Java Bundle
To download your JDK 8 and NetBeans 8.0 software bundle, do the following :
- Go to Java SE Downloads.
- Click “NetBeans DOWNLOAD” to display the JDK 8 with Netbeans 8.0 window.
- Click “JDK 8 and NetBeans 8.0 Cobundle License Agreement” to display its window.
- Read the agreement and then close its window.
- Select “Accept License Agreement.”
- Click the download file for your operating system, and then wait for the download to finish. Note: If you have a 64-bit operating system, select an x64 bundle. For 32-bit operating system, select an i586 bundle.
- Continue according to the section below.
Installing Your Java Bundle
Your downloaded Java software bundle is an executable file through which you launch an installation program for the JDK and NetBeans. Install your Java bundle according to the two subsections below:
- Running Your Bundle Executable File
- Running Your Bundle Installation Program
Running Your Bundle Executable File – How you run your bundle executable file varies according to your operating system.
If you have Linux, your executable file is a .sh file. For example, if you have 32-bit Ubuntu Linux, your executable file is jdk-8-nb-8-linux-i586.sh, which is a shell script that you run as follows:
- Open a terminal window as shown in the second image above.
- At the $ prompt, type “cd Downloads” (without quotation marks) and then press “Enter.”
- At the /Downloads$ prompt, type “sudo bash jdk-8-nb-8-linux-i586.sh” and then press “Enter” to display a password prompt.
- Type your password and then press “Enter” to run the script and open the installation-program Welcome window.
Note: For more information, see Installing the Software Bundle on Linux.
If you have OS X, your executable file is a .dmg file. For example, if you have 64-bit OS X (v10.7.3 or newer), your executable file is jdk-8-nb-8-macosx-x64.dmg. Run this executable file as explained in Installing the Software Bundle on OS X.
If you have Windows, your executable file is an .exe file. For example, if you have 64-bit Windows, your executable file is jdk-8-nb-8-windows-x64.exe. Run this executable file as explained in Installing the Software Bundle on Microsoft Windows.
Running Your Bundle Installation Program – Run your bundle installation program as follows:
- Run your bundle executable file according to the section above .
- In the Welcome window, click “Next” to display the JUnit License Agreement, select “I accept the terms in the license agreement. Install JUnit,” and then click “Next.”
- Choose the JDK installation folder or accept the default (currently required in Windows), and then click “Next.”
- Choose the NetBeans IDE installation folder and the JDK for the IDE, or accept their defaults, and then click “Next.”
- Review the Summary, select “Check for Updates,” and then click “Install.”
- After the bundle installation program displays its Setup Complete window, click “Finish” to close the window.
- Create a desktop shortcut for NetBeans IDE 8.0, and then continue according to the section below.
Creating Your First Java Application
After downloading and installing your Java bundle, you can create your first Java application as follows:
- Double-click “NetBeans IDE 8.0” (either in your applications menu, or on your desktop) to launch your IDE.
- Click “File,” click “New Project,” click “Java,” select “Java Application” and then click “Next.”
- Type “HelloWorldApp” as the Project Name, and then click “Finish” to display the initial Java code.
- Scroll to the following comment line: // TODO code application logic here
- Type over that comment line with: System.out.println(“Hello World”);
- Click “File,” click “Save,” click “Run” and then click “Run Project (HelloWorldApp)” to display Hello World! in the Output window of your NetBeans IDE as shown in the third image above.
Note: For more information, go to A Closer Look at the Hello World Application.
After downloading and installing your Java bundle, and creating your first Java application, you can use the web to learn more about developing Java applications. Here are a few sample links:
- Java Tutorials Learning Paths
- NetBeans IDE Java Quick Start Tutorial
- Webucator Free Java Tutorial
- Developing Applications with NetBeans IDE
- University of Texas Java Coding Samples