Getting started with Java development

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:
  1. Go to Java SEDownloads as shown in Figure 1.
  2. Click NetBeans DOWNLOAD to display the JDK 8 with Netbeans 8.0 window.
  3. Click JDK 8 and NetBeans 8.0 Cobundle License Agreement to display its window.
  4. Read the agreement and then close its window.
  5. Select Accept License Agreement.
  6. 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.
  7. Continue according to the section below.
Figure 1 - Java Standard Edition (SE) downloads window
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:
  1. Running Your Bundle Executable File
  2. 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:
  1. Open a terminal window as shown in Figure 2.
  2. At the $ prompt, type cd Downloads and then press Enter.
  3. At the /Downloads$ prompt, type sudo bash jdk-8-nb-8-linux-i586.sh and then press Enter to display a password prompt.
  4. 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.
Figure 2 - Terminal window in Xubuntu, an Ubuntu Linux distribution
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 onMicrosoft Windows.

Running Your Bundle Installation Program - Run your bundle installation program as follows:
  1. Run your bundle executable file according to the section above .
  2. 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.
  3. Choose the JDK installation folder or accept the default (currently required in Windows), and then click Next.
  4. Choose the NetBeans IDE installation folder and the JDK for the IDE, or accept their defaults, and then click Next.
  5. Review the Summary, select Check for Updates, and then click Install.
  6. After the bundle installation program displays its Setup Complete window, click Finish to close the window.
  7. 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:
  1. Double-click NetBeans IDE 8.0 (either in your applications menu, or on your desktop) to launch your IDE.
  2. Click File, click New Project, click Java, select Java Application and then click Next.
  3. Type HelloWorldApp as the Project Name, and then click Finish to display the initial Java code.
  4. Scroll to the following comment line: // TODO code application logic here
  5. Type over that comment line with: System.out.println("Hello World");
  6. 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 Figure 3.
Note: For more information, go to A Closer Look at the Hello World Application.
Figure 3 - Your first Java application in NetBeans
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:

No comments :

Post a Comment