The Planetarium

           Java for all clients: Java SE, Java ME, JavaFX and JavaCard

JDK 7: Jigsaw and classpath

Filed under: java jdk jdk7 on Thursday Jul 23, 2009

Developers have sometimes had to try to square the circle with the Java classpath over the years. What really is a linear model in multiple sections works for much of the time. But as applications get larger, and the dependencies between it and the libraries it needs get more complex, things break down.

Luckily, Project Jigsaw will be providing a cleaner dependency model in JDK 7 to save developers from trying to prove the impossible.

In the meantime, Joe posted a great visual summary of the three sections of the Java classpath.

Java ME: Bluetooth or NFC ?

Filed under: javafx javame on Monday Jul 20, 2009

Most new feature phones now have Bluetooth, and so most support the Java APIs to allow Java (and JavaFX) applications to drive it. And as you can see in this survey of Java ME tools, all the major development tools for Java ME phones support the APIs too. You may also have noticed some rather naughty uses of it too.

When the phone manufacturers finish up the next version of Java ME for feature phones, more of them will support Near Field Communication (NFC).

Leaving applications that need to transfer things like love notes, wedding invitations, baby photos (possibly in that order) a choice of whether to use Bluetooth or NFC to do it.

Check out this article to see the merits of each approach.

When JavaFX and physics collide

Filed under: javafx on Friday Jul 17, 2009

Just some Friday fun.

Phys2D is a Java library that models the mathematics of physical objects. Run this webstart demo to see. Fun, huh ?

Now apply it to shopping, use it from JavaFX, and here's what you get.

Summarizing Java language changes for JDK 7

Filed under: jdk jdk7 on Thursday Jul 16, 2009

There haven't any changes to the Java language since J2SE 5.0 in 2004. But there are several planned for JDK 7, coming from a variety of sources (sic). Here's a quick summary:

1) Module support. Known historially as superpackages, though they are assuredly not, this promises to sit atop a variety of module systems to let developers partition big chunks of code more effectively.

2) Type Annotations. Step three in the popular annotations program, this hopes to further extend the reach of attaching meta-data to Java code by letting developers put it in more places.

3) And of course, Project Coin. The small useful changes to soothe away some of the common irritations with the langauge. The most likely handful have been picked (Strings in switch, improved exception handling, ARM blocks, improved type inference, Null safe operators, and simplified varargs), and there's another handful going through the mangle. Including some rather interesting ones for developers hoping to use JSR 292 to implement (better, faster...) a dynamic language on the JVM.

Some might be glad of that !

Yesterday's weekly build of JDK 7 includes a big set of changes: more backporting of Java SE 6uX features, fixes to Nimbus, fixes to NIO2, and the like. But most notably, as planned in May, the incorporation of the other Java language addition for JDK 7: Type Annotations.

Java Annotations have been enormously successful since their introduction in J2SE 5.0, allowing a wide range of different kinds of information to be attached to source code. From signaling that tools make a variety of checks be made to your methods or classes, to the partial eradication of unwieldy deployment descriptors in Java EE (Aside: how the world turns ! The Planetarium Janitor remembers the very earliest pre-release days of in the corridors of Java EE, when deployment descriptors were property files).

In Java SE 6, JSR 269 introduced 'Pluggable Annotations' with an API for tools to be able to manipulate custom annotations of their own design.

And now, JDK 7 will allow Java Annotations to go where no Java Annotation has gone before. Read all about the project here.

JavaFX Coding Challenge Winners

Filed under: javafx on Monday Jul 13, 2009

You don't need to wait for the Java App Store to open its doors layer this summer to see what kind of commercial applications you can use JavaFX to create. Just take a look at the winners of the JavaFX coding challenge.

In first place, Sten Anderson's Music Explorer FX uses the Echo Nest service to power a beautiful, engaging fullscreen application that pulls images, videos, plays music, shows news and reviews, similar artists, and keeps a history or your musical exploration.
Next is Naoaki Suganuma's LifeScope: hooking up to a server hosted on Google's App Engine, this application pulls data from your blog, examines EXIF data from your photo library and the friends Gmail address book to chain together an interactive view of the events and friends so catalogued.
And in third place, Evgeni Sergeev's ShiningEtherFX is an image creation tool specially for making background images for web pages or RIA applications by compositing layers of images created from a color scheme, path curve and profile.

And there were student winners too. Check them out.

Scala Lifting Off ?

Filed under: java jdk multilanguage on Friday Jul 10, 2009

If you are think about adding a new language to your programming language history, then you are probably following the recent discussions about whether Scala will replace the Java language, summarized here at InfoQ and with a followup from James 'Groovy' Strachan here.

Scala is an object oriented and functional language, like many other JVM languages. Yet unlike many of today's JVM langauges is statically typed. It's been implemented on other platforms (.NET, Android) but still primarily appears to be used on the Java SE 6 VMs. It's been through a couple iterations since its first release in late 2003, and although typically Scala programs use the underlying Java APIs, frameworks are starting to appear for Scala, most notably, Lift, for web app development.

And NetBeans seems to be ahead of the curve in its support for Scala.

A nice way to see if you agree it could replace Java one day.

Best-kept secret in the JDK ?

Filed under: jdk on Thursday Jul 09, 2009

If you don't have the remotest idea what it is, you should check out this paen to the VisualVM.

Jazoon 2009

Filed under: conferencenews javafx jdk7 on Wednesday Jul 08, 2009

While JavaOne is pretty much the focal point for announcing stuff, and is really a consistently well attended conference, for those of you in Europe, two conferences: Devoxx (nee Javapolis) and the 3 year old Jazoon are  becoming must attend events.

James Gosling opened the recent Jazoon conference, and proceeded to meet many of the 1100 attendees. Your humble Janitor also gave a keynote the next morning (slides), attempting to continue a long tradition of reducing the world into pithy top 10 lists: this time covering JDK 7 and JavaFX 1.2.

As usual, there was an immense variety of talks. Most all of which you can get the slides for here.

Playing JavaCards

Filed under: javacard on Tuesday Jul 07, 2009

With this week's news that the UK London police force will deploy 80,000 smart cards with JavaCard for its building and system access, its good to see that there's a great new way to start working with the technology:

The PlaySIM project is an open source software and hardware project that is truly a playground for a variety of scenarios for JavaCard. A JavaCard is nothing without the environment to which it connects, whether that be through a magnetic reader, near field communication bridge, or if you remember the people counting sensors deployed at JavaOne 2008, in a SunSPOT.

See an in-depth talk about PlaySIM here.

JavaFX on Swing, Swing in JavaFX

Filed under: javafx swing on Monday Jul 06, 2009

To a large degree JavaFX is designed with a new generation of developers in mind, those with a little more art than science in their backgrounds. More into shifting shapes on screen than polymorphism in code. And they may well be wearing skinny jeans for the first time, unlike the Janitor who was pioneering them in the 1980s.

But for Swing developers who have art and science in equal measure, JavaFX is a great companion to add to the portfolio.

Original team member Amy Fowler blogged recently about how to use JavaFX to make over an existing Swing application.

And with the latest release of the JFXtras, a handy suite of goodies for JavaFX development, comes the new JavaFX wrapper for Swing components, as you can read all about here.

Sampling JavaFX 1.2

Filed under: javafx on Thursday Jul 02, 2009

One of the best ways to chart the progress of JavaFX these days is simply to go and look at the samples.

The new set of UI controls and layout managers in JavaFX 1.2 are pretty nifty. So its easy now with these new additions to the scenegraph to go from gamesy style (like Brick Breaker, or Pac-Man) to plain fun, like the flickr photo viewer, through drawing centric apps all the way to the more traditional interface, like this project manager, or any hybrid inbetween. With its own skin in CSS.

Getting data into a JavaFX application is easier too: you can easily fetch the data in a background task, as seen in this simple Twitter client, or get it from an RSS or ATOM feed, and no matter where you are (Desktop (Windows, Mac, OpenSolaris or Linux), mobile or TV) you have application data stick around locally between sessions.

And with the new RTSP support for media, smaller application binaries and runtime optimisations, you should notice a jump in speed also.

Garbage First 'quite zippy'

Filed under: java javase jdk7 on Wednesday Jul 01, 2009

You've probably been told over the years how great JVMs are. How well they've scaled, perform under a variety of different loads. How its doing its part to take advantage of the processing power of multi-core systems now that cranking the clock rate is almost wrung dry.

The automatic memory management provided by the JVM's garbage collector is one of the most important aspects of scaling the JVM. There are many different kinds - as this great primer shows.

The new (free) Hotspot Garbage First collector in beta form for evaluation in Java SE 6u14, and which will ship production quality in JDK 7 is summarized succinctly here, and you can find a more detail here about this generational, compacting, mostly parallel collector that offers a much smoother ride that the CMS collector will replace.

And some early signs of use are encouraging !