Java gets going with version 8

Guests

Other programming languages are increasingly using the JRE as a base. This began with ports of old acquaintances like Python or Tcl but now also includes new languages like Scala [4], Ceylon [6], or Groovy [7]. For these languages to run as fast as possible on the Java Virtual Machine (JVM), Java 7 introduced support for dynamic languages (invokedynamic).

One of the beneficiaries is the Nashorn JavaScript interpreter developed by Oracle, which in Java 8 replaces the old Rhino interpreter of previous versions and offers 100 percent support for the JavaScript specification [8] (Rhino: 95 percent; Firefox 26: 99.3 percent) and much better performance.

In tests against the SunSpider [9] benchmark, Nashorn is, on average, a factor of four better than Rhino; individual tests run up to 40 times faster (Figure 2). This means that not only have the promises of invokedynamic been redeemed, but JavaScript now provides a lightweight scripting language for Java applications that can be used without additional libraries.

Figure 2: The new JavaScript interpreter, Nashorn, beats its predecessor Rhino by miles.

Special Effects

The rich client library Java FX has been through an interesting development (Figure 3). Highly praised in advance of its release as the designated successor of Swing, it was already declared dead after getting off to a false start. It has hardly featured in the media in the past two years, but has since been converted into a normal Java library in the form of Java FX 2.0.

Figure 3: Java FX offers a modern user interface library with many built-in widgets.

Like SVG, for example, it supports the development of surfaces based on a scene graph, which can also contain widgets like TreeTable or calendars in addition to graphic primitives such as lines and planes. Java 8 sees FX enter the game in a major way for the first time: Oracle offers it for Linux, Mac, and Windows. Unfortunately, Oracle is not working on the port for Android and iOS itself, and community projects [10] do not always receive the required corporate approval. This is unfortunate, because supporting mobile devices and desktops with a single GUI library would be a killer feature.

Desktop and Mobile

With some exceptions, such as Minecraft, new Java desktop applications are not the rule; today's choice is typically HTML5, which enables manufacturers to save in the desktop department, but at the price of technological restrictions. Although Java FX applications are allowed to access all Java libraries and local files, web applications apply strict limitations. People who viewed the use of local keys and certificates as a necessity a year ago may have been regarded as security nuts, but it has become the standard requirement for enterprise applications and still requires a rich client.

Another application was presented by Jasper Pott and Richard Blair at the last Java One in September 2013. The DukePad [11] is a tablet based on the Raspberry Pi and Linux, with Java FX as the UI. Plans for the hardware are available under the GPLv2; in combination with open source Linux, Java, and Java FX, this means a totally open source device. It will probably not outdo the typical Android tablets in terms of public popularity, but as a basis for kiosk applications or displays on machine controls, it offers an attractive development environment.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • JavaScript Alternatives

    JavaScript is the stuff of which many interactive web clients is made, but it comes with a fair amount of historical ballast. The creators of four alternative scripting languages seek to ditch the ballast.

  • Kotlin Programming Language

    Kotlin, a small island in the Gulf of Finland, is also the name of a new programming language that aims to become a modern alternative to Java.

  • CoffeeScript

    Through the years, many languages have tried to improve or even replace JavaScript, including CoffeeScript, which runs in all JavaScript Runtime Environments and compiles into JavaScript.

  • AJAX Workshop

    Books were the original model for website design. Navigation was similar to flipping the pages. Thanks to AJAX, many state-of-the-art websites now behave like desktop applications.

  • Google Web Toolkit

    The Ingenious Google Web Toolkit builds optimized JavaScript applications in a hurry.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News