Building and Running Java 8 Support

The Eclipse support for Java 8 is not yet available for download. If you want to play with it, you’ve got to build it. Eclipsepedia’s JDT Core/Java8 page includes instructions for setting up your development environment with the source for the evolving Java 8 support in the Eclipse Java development tools (JDT). There’s a few pieces missing from the instructions; I’ll circle back later and add them in.

I started by installing Java Development Kit (JDK) 8. I didn’t look very hard for an RPM; instead, I just went straight to the source. For Linux, it comes as a tar.gz file that I just decompressed into a working directory.

Next, I downloaded the latest milestone build of the Eclipse SDK (4.4M5 at the the time of writing). This isn’t a stated requirement, but I decided that it would be a good starting point. I configured the “vm” option in the eclipse.ini file to use the Java 8 JRE included with the downloaded JDK. I added “Git Team Provider” to the SDK from the Luna software repository.

The JDT is spread across a small number of Git repositories:

  • JDT Core git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git
  • JDT UI git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git
  • JDT Debug git://git.eclipse.org/gitroot/jdt/eclipse.jdt.debug.git

Some Equinox updates are also required (I believe that this primarily to provide the required Java 8 Execution Environment).

In all repositories, the code is contained in the BETA_JAVA8 branch. I cloned all of these repositories and used the handy “Import all projects” feature to automatically pull all the code into my workspace.

At this point, my Package Explorer contained a lot of red marks. Many of the plug-ins are configured to be compiled by very specific Java versions that I did not already have installed. So, I hunted down JDKs for Java 1.4, 5, and 6 (I already had Java 7 installed). I opted to download the self-extracting archives.

I added each of these to the “Installed JREs” page in the preferences.

Configure Java Runtime Environments (JRE) (and corresponding JDKs)

Configure Java Runtime Environments (JRE) (and corresponding JDKs)

Then I configured execution environment mappings for each JRE.

This made most, but not all, of the red marks disappear.

Per the instructions, I downloaded Eclipse SDK 4.3.1 for use as a clean target platform and API baseline (though I suspect that it’d be just fine to use the 4.4M5 for both). Frankly, I don’t recall if any more of the red marks disappeared with this step.

I decided to go for it in spite of the remaining red marks (which appear to be tests that I haven’t properly configured), and set up a launch configuration. It’s alive.

Eclipse running with Java 8

Eclipse running with Java 8

I started by tinkering a bit with lambda expressions.

The short version is that the Eclipse compiler for java (ECJ) handles them well. Content assist isn’t quite baked yet, but syntactically-correct lambda expressions compile and run as expected. It’s clear from the activity in Bugzilla, that this is moving along quickly.

As an Old Guy who Knows Smalltalk, my first instinct is to create Smalltalk-like collections in Java.

Smalltalk:

| employees names |
employees := OrderedCollection new
	add: (Employee named: 'Wayne');
	add: (Employee named: 'Joel');
	add: (Employee named: 'Jon');
	add: (Employee named: 'Anthony');
	yourself.
names := employees collect: [:employee | employee name].
output >> an OrderedCollection('Wayne' 'Joel' 'Jon' 'Anthony')

Java 8:

OrderedCollection employees = new OrderedCollection();
employees.add(new Employee("Wayne"));
employees.add(new Employee("Joel"));
employees.add(new Employee("Jon"));
employees.add(new Employee("Anthony"));
OrderedCollection names = employees.collect(employee -> employee.name);
output >> [Wayne, Joel, Jon, Anthony]

More on this later.

Please note the disclaimer on the bottom of the JDT Core/Java8 page:

This is a work in progress. The contents of the BETA_JAVA8 branch will be updated as the changes are made to the JSR Specification. Please use the early access builds only in a test/evaluation mode and not in the real development environment. If you need any help with this, please contact the JDT/Core team through either the forum or Bugzilla.
 

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


× six = 54



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close