MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Netbeans 8 – Fedora

with 5 comments

Some of my students want to use the Fedora image that I built for my database classes in my Java software development life cycle course. As a result, they wanted a Java development environment installed. I examined JDeveloper 11g (11.1.1.7.0) and 12c (12.1.3) but resolved on the more generic Netbeans 8 (8.0.2) IDE.

JDK 7 with Netbeans 8 Download

You can download the generic Netbeans 8 IDE, the JDK 7 with Netbeans, or the JDK 8 with Netbeans for the Linux installation. After you download the executable program, you should follow these instructions to install the Netbeans 8 IDE on Fedora.

As the student user, you can download the file to your ~student/Downloads directory and then run these two commands:

chmod +x ./jdk-7u80-nb-8_0_2-linux-x64.sh
sudo ./jdk-7u80-nb-8_0_2-linux-x64.sh

It produces the following output log:

Configuring the installer...
Searching for JVM on the system...
Preparing bundled JVM ...
Extracting installation data...
Running the installer wizard...

Then, it launches the installer. These screens show you how to install and create your first Java project.

JDK 7 with Netbeans 8 Installation

JDK7Netbeans8_01

  1. The first installation dialog welcomes you to the JDK 7 Update and NetBeans 8 Installer. Click the Next button to proceed.

JDK7Netbeans8_02

  1. The second installation dialog asks you to accept the terms in the license agreement. Click the Next button to proceed.

JDK7Netbeans8_03

  1. The third installation dialog asks you to install Netbeans 8. Click the Browse button if you would like to install it in a different area. Click the Next button to proceed.

JDK7Netbeans8_04

  1. The fourth installation dialog asks you to install another Java JDK 7 that supports the current release of Netbeans 8. Click the Browse button if you would like to install it in a different area. Click the Next button to proceed.

JDK7Netbeans8_05

  1. The fifth installation dialog shows you the progress bar for installing Java JDK 7 that supports the current release of Netbeans 8. You may not need to click the Next button to proceed because it should progress to the Netbeans progress dialog. Click the Next button to proceed when it doesn’t do it automatically.

JDK7Netbeans8_06

  1. The sixth installation dialog shows you the progress bar for installing Netbeans 8. Click the Next button to proceed when it doesn’t do it automatically.

JDK7Netbeans8_08

  1. The next screen is the final screen of the Java SE Development Kit and NetBeans IDE Installer. Click the Finish button to complete the installation.

After the installation, you need to check if the netbeans program can be found by users. It shouldn’t be found at this point because it isn’t in the default $PATH environment variable.

Configuring the student user

You can set the $PATH variable dynamically like this:

export PATH=$PATH:/usr/local/netbeans-8.0.2/bin

The netbeans program location was set in Step #4 of the Netbeans installation. After setting the $PATH environment variable, you can run netbeans with this syntax:

./netbeans &

However, the better approach is to put the following lines in your .bashrc file. This change ensures that you can access the netbeans program anytime you launch a Terminal session.

# Add netbeans to the user's PATH variable.
export PATH=$PATH:/usr/local/netbeans-8.0.2/bin

After you have configured the student user’s .bashrc file, you can now use Netbeans to create a Java project.

Create a new Netbeans project

JDK7Netbeans8_07

  1. The next screen is the Netbeans 8 Start Page. This is where you can create your first Java development project.

JDK7Netbeans8_09

  1. You click the File menu and then the New Project menu option to open a new project.

JDK7Netbeans8_10

  1. It launches the New Project dialog at Step #1 – Choose Project, where you choose Java from your Categories list and Java Application from the Projects list. You click the Next button to continue.

JDK7Netbeans8_11

  1. It launches the New Project dialog at Step #2 – Name and Location, where you enter a Project Name. The example uses MySQLJava as the project name. You click the Next button to continue.

JDK7Netbeans8_12

  1. It launches the MySQLJava.java tab in the Netbeans 8 application. This is where you can enter your code.

After you successfully download the Java 7 SE and Netbeans 8, you should download JDK 8 with Netbeans 8 because Java 7 EOL (End-of-Life) is April 30th, 2015. You may think that you need to uninstall the JDK 7 with Netbeans 8 before you install the JDK 8 with Netbeans 8, but you don’t have to do so. When you install JDK 8 with Netbeans 8 into an environment with a preinstalled JDK 7 with Netbeans 8, the installer only adds the JDK 8.

The following segments of the post show you how to download and install JDK 8 with Netbeans 8, and how to configure Netbeans to work with the JDK 7 and JDK 8 as interchangeable libraries.

JDK 8 with Netbeans 8 Download

You can now download the JDK 8 with Netbeans for the Linux installation. After you download the executable program, you should follow these instructions to install it on Fedora.

As the student user, you can download the file to your ~student/Downloads directory and then run these two commands:

chmod +x ./jdk-8u45-nb-8_0_2-linux-x64.sh
sudo ./jdk-8u45-nb-8_0_2-linux-x64.sh

It produces the following output log:

Configuring the installer...
Searching for JVM on the system...
Preparing bundled JVM ...
Extracting installation data...
Running the installer wizard...

Then, it launches the installer, which will be very similar to the steps you went through earlier. There are differences. There are only five screens that you navigate as opposed to the seven from the earlier JDK 7 with Netbeans 8 installation, as you’ll see below.

JDK 8 with Netbeans 8 Installation

JDK8Netbeans_01

  1. The first installation dialog welcomes you to the JDK 8 Update and NetBeans 8 Installer. Click the Next button to proceed.

JDK8Netbeans_02

  1. The second installation dialog installs the JDK 8. Click the Next button to proceed.

JDK8Netbeans_03

  1. The third installation dialog is a summary of what you’ll install. Click the Install button to proceed.

JDK8Netbeans_04

  1. The fourth installation dialog shows you a progress bar. You don’t need to do anything but watch the progress.

JDK8Netbeans_05

  1. The fifth installation dialog shows you the installation is complete. Click the Finish button to proceed when it doesn’t do it automatically.

After you have installed the JDK 8 SE, you can use Netbeans to add the JDK 8 platform.

Add the JDK 8 Platform to Netbeans 8

JDK8Platform_01

  1. After you open Netbeans 8, you choose the Tools menu choice. Then, you select the Java Platforms menu option.

JDK8Platform_02

  1. It launches the Java Platform Manager dialog. You click the Add Platform button to add the JDK 8 platform.

JDK8Platform_03

  1. It launches the Add Java Platform dialog. Leave the Java Standard Edition radio button checked. You click the Next button to proceed.

JDK8Platform_04

  1. It launches the Add Java Platform file chooser dialog. Here you navigate to find the JDK 8 software, which is located in /usr/local/jdk1.8.0_45 directory.

JDK8Platform_05

  1. After selecting the /usr/local/jdk1.8.0_45 directory as the platform folder, click the Next button to proceed.

JDK8Platform_06

  1. After setting the directory, you’re asked to verify the Java Platform information. If it’s correct, click the Finish button to proceed.

JDK8Platform_07

  1. After finishing the installation, you’ll see that you have two installed Java Platforms. Unfortunately, the first one installed is the default unless you modify the netbeans.conf file. You click the Close button to complete the process.

Set JDK 8 Platform as the Default Java Platform for Netbeans 8

After adding the JDK 8 Java Platform, you can change the default setting my manually editing the /usr/local/netbeans-8.0.2/etc/netbeans.conf file. You simply remark out the line for JDK 7 and replace it with one for JDK 8, as shown below. The next time you boot the Netbeans application it uses Java 1.8.

# netbeans_jdkhome="/usr/local/jdk1.7.0_80"
netbeans_jdkhome="/usr/local/jdk1.8.0_45"

The next time you launch Netbeans 8, it will use JDK 8 because you set that as the default Java Platform

As always, I hope this helps those looking for information like this.

Written by maclochlainn

April 29th, 2015 at 1:32 am