Java is a high-level, general-purpose, object-oriented programming language. Java syntax was mostly inherited mostly from C and C++ programming languages. As an object-oriented language, Java is class-based and supports concurrency. Compared to C and C++, many complexities of development are hidden from users of the language. Just like C and C++, Java is a compiled language. It was developed with the intention of “write once, run anywhere” which can be more interpreted as “write once, compile and run anywhere”. Java code is not directly compiled into executable code but is compiled into byte code that can run on a Java Virtual Machine (JVM) on any computer platform, whether it is Windows, MacOS or Linux.

Java programming language was developed by James Gosling at Sun Microsystems. It was first released in 1995 as a part of the Java platform of Sun Microsystems. Though initially developed with different intentions, it became one of the most popular programming language for World Wide Web which was emerging at the same time. Since its first release, the language added many new features like generics and lambda notations, which contributed to its popularity.

This tutorial is a guide for Java 8 and the last section of the tutorial explains what new features were introduced with Java 8. Java is backwards compatible and code written with older versions of Java will still work with Java 8.

Java SE Setup

Most operating systems come with JRE (Java Runtime Environment) already installed. JRE contains a JVM and it is what’s required to run the Java byte code. To find out what version of Java your operating system has, open a new terminal window and execute the following command.

java -version

If java is not installed in your operating system, you will get an error when this command is executed. Otherwise, depending on the version installed, the output should be something like

java version “1.6.0_65”

Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-10M4609)

Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

Java Platform, SE (Standard Edition) is the platform used for the development and deployment of Java in code in supported environments. The standard package for Java SE contains the binaries for operations like compiling and running Java code in addition to JRE. Java SE can be downloaded freely from Oracle website. The link to the download page is

On this page, you can select the installation file appropriate for your operating system, accept the license agreement and then download the file. The installation instructions are mostly straightforward and can be found on the web site.

[Should we add the installation instructions with screenshots?]

Once the installation is complete, you need to set the related environment variables to use it. Java executables are in the bin directory under the installation location. To use Java, this directory needs to be on the execution path of your operating system. Java installation directory, as a convention, is referred to as JAVA_HOME and it may come handy to define an environment variable for that on your operating system.

Windows Installation

While installing Java on Windows, it is recommended to use a path that does not have spaces in it, like C:\jdk, instead of the default installation path C:\Program Files\Java. By default, jdk1.8.0 and jre1.8 folders will be created under C:\Program Files\Java.

Following the installation, the following instructions should be followed:

  • Right click on My Computer and from the menu select Properties
  • Click on Advanced system settings on the left menu
  • Switch to Advanced tab
  • Click Environment variables
  • Select Path from System variables. If it does not contain <java installation directory>/bin, add the <java installation directory>/bin directory to Path. The easiest way to do this is to add a ; to the end of the path and append <java installation directory>/bin to it. Click OK and it will be effective going forward.

Linux and MacOS Installation

Once the installation is complete on Linux or MacOS, execute the following command to see if your java executables are on the execution path of your operating system.

echo $PATH

If the path does not contain <java installation directory>/bin, open your profile file for edit. This is the file that keeps profile specific instruction that are executed each time a terminal is opened and its name depends on the shell you use. If you use bash shell, it would be .bash_profile under your home directory. If it does not exist, create it. Following that, add this to your profile file.

export PATH=$PATH:<java installation directory>/bin

Once this is done, open a new terminal window and check the $PATH variable again. It should contain your java executables directory.

Now your development environment is ready for you to start writing code with Java, compile it and run it. Before we work with actual examples, we will take a look at some of the basic concepts related to Java language for understanding it better.


%d bloggers like this: