You are here: Home » New features in Java 8 » Introduction

New features in Java 8

Introduction

Java 8 introduces many new features. A list of the corresponding Java Enhancement proposals is available at http://openjdk.java.net/projects/jdk8/features.

This article describes some of these new features, especially those which are related to the language (syntax and semantics) and to new methods and classes in the API. This is still work in progress, so new sections will be added over time.

The Java8 API documentation is available at http://download.java.net/jdk8/docs/api/.

Since Java 8 also introduces new language features, current IDEs often do not yet fully support the new version - for example, for Eclipse, an Java 8 enabled version is necessary. A pre release version can be downloaded from http://download.eclipse.org/eclipse/downloads/drops4/P20140317-1600/.

I was using a different approach, and used a simple ant build file to build the Java 8 related code samples. The build file looks similar to this:



<project name="java8" default="run" basedir=".">
  <property name="src" value="src"/>
  <property name="build" value="bin"/>

  <target name="run" depends="build">
    <java classname="com.example.java8.Main">
        <classpath>
           <pathelement location="${build}">
         </pathelement></classpath>
    </java>
  </target>

  <target name="build" depends="clean">
    <mkdir dir="${build}"/>
    <javac srcdir="${src}" destdir="${build}">
        <compilerarg value="-parameters">
    </compilerarg></javac>
  </target>

  <target name="clean">
    <delete dir="${build}">
  </delete></target>

</project>
All code samples are also available in my github repository at https://github.com/afester/CodeSamples/tree/master/Java8.