Installing Netbeans and Java JDK in Ubuntu 14.04 and Setting Up a Basic HTML5 Project
In this 4-article mobile web development series, we will walk you through setting up Netbeans as an IDE (also known as Integrated Development Environment) in Ubuntu 14.04.2 LTS Trusty Tahr to start developing mobile-friendly and responsive HTML5 web applications.
Following are the 4-article series about HTML5 Mobile Web Development:
A well-polished work environment (as we will later see), autocompletion for supported languages, and its seamless integration with web browsers are, in our opinion, some of Netbeans, most distinguishing features.
Let us also remember that the HTML 5 specification brought many advantages for developers – to name a few examples: cleaner code thanks to many new elements), built-in video and audio playback capabilities (which replaces the need for Flash), cross-compatibility with major browsers, and optimization for mobile devices.
Although we will initially test our applications on our local development machine, we will eventually move our web site to a LAMP server and turn it into a dynamic tool.
After you go through this brief series, you will be able to:
- use the tools described herein to create basic HTML5 dynamic applications, and
- go on to learn more advanced web development skills.
However, please note that even though we will be using Ubuntu for this series, the instructions and procedures are perfectly valid for other desktop distributions as well (Linux Mint, Debian, CentOS, Fedora, you name it).
To that end, we have chosen to install the necessary software (Netbeans and the Java JDK, as you will see in a minute) using a generic tarball (.tar.gz) as installation method.
That being said – let’s get started with Part 1.
Installing Java JDK and NetBeans
This tutorial assumes that you already have an Ubuntu 14.04.2 LTS Trusty Tahr desktop installation in place. If you don’t, please refer to Ubuntu 14.04 Desktop Installation article, written by our colleague Matei Cezar before proceeding further.
Since the Netbeans version that is available for download from the Ubuntu official repositories (7.0.1) is a little outdated, we will download the package from the Oracle website to get a newer version (8.0.2).
To do this, you have two choices:
- Choice 1: download the bundle that includes Netbeans + JDK, or
- Choice 2: install both utilities separately.
In this article we will choose #2 because that not only means a download that is a bit smaller (as we will only install Netbeans with support for HTML5 and PHP), but also will allow us to have a standalone JDK installer should we need it for another setting that does not require Netbeans nor involve web development (mostly related to other Oracle products).
To download JDK 8u45, go to the Oracle Technology Network site and navigate to the Java → Java SE → Downloads section.
When you click on the image highlighted below, you will be asked to accept the license agreement and then you will be able to download the necessary JDK version (which in our case is the tarball for 64-bit machines). When prompted by your web browser, choose to save the file instead of opening it.
When the download is complete, go to ~/Downloads and extract the tarball to
$ sudo tar xf jdk-8u45-linux-x64.tar.gz -C /usr/local/bin
To install Netbeans with support for HTML5 and PHP, go to https://netbeans.org/downloads/ and click Download as indicated in the following image:
This will cause your browser to either open the installation shell script or save it to your computer. Choose Save File, then OK:
Once done, turn the
.sh into an executable file and then run the shell script with administrative privileges:
$ cd ~/Downloads $ chmod 755 netbeans-8.0.2-php-linux.sh $ sudo ./netbeans-8.0.2-php-linux.sh --javahome /usr/local/bin/jdk1.8.0_45
From then on, follow the on-screen instructions to complete the installation leaving the default values:
and wait for the installation to complete.