Sampling Java SE 6 Features

As if you didn't need any more reasons to go get JDK 6, we've made some changes and additions to the samples and demos we include in the JDK.

For those of you who are historically minded, the original bouncing doodad style applets appeared in the first JDK as demonstrations of what the, then, new technology could do. In later releases our thinking changed somewhat, so we stopped trying to do flashy (I know, but applets WERE flashy in 1996), and started adding samples that made the APIs easy to get your head around.

NetBeans Projects

You'll notice the first change if you use NetBeans (did I ever tell you I do ?). Because Ivan added Netbeans project files for the samples and demos ! (Now why didn't we think of that before...) Anyway, you can still build everything on the command line if you want to, as always. But building, running and browsing though the sample and demo code is so much nicer in NetBeans. As I was just doing (screenshot) to help me write an article about the new features in Java SE 6 for JavaPro (should appear later this month !).

Fresh Samples

We also added some new samples to help people out who are interested in the new APIs we added in Java SE 6. Load 'em up in NetBeans and hit run.

Real Web Services

Rajiv designed really nice sample for the new web services APIs we added to Java SE 6. Its in two pieces, one is a server application that pretends to be eBay, and exposes a simple web service for browsing items for auction. The other piece is a client application that can browse the items in the dummy server. But its all web services, so the neat thing is that the client application, by editing a property or two, can also browse items that are REALLY at the REAL eBay (or in the developer sandbox, if you prefer). Like I did - here's a snapshot or something intriguing I found at eBay.

I nearly bought it as well. Its so me.


Sundar cranked out a neat little application masquerading as a notepad text editor. Except its a JavaScript console written in Java, where you can type in some JavaScript and run it. Showing of course the new scripting support in Java SE 6. You can also have it load up some example JavaScript if you like - also known as the "here's one I made earlier" didactic tool. Here's what happened when I played around with it, hacking up some simple GUIs in JavaScript and then asking Scriptpad to run it

The script...

...this is what happens when you run it

Annotation Processing

Joe, when not being interviewed by all and sundry, checked in a nice little annotation processor for checking the naming conventions described in the Java Language Specification are being followed. So if you've always been looking for a polite way to tell your best developer friend that the over/under-capitalisation in their class and method naming is just beyond embarrassing for you, feel free to compile the source code to this annotation processor sample and slip it into their build script overnight to avoid a tearful confrontation.


Daniel added a great sample to show how to use JMX to instrument applications to make them manageable. Well more a blueprint really because its a natural follow on to all the guides and tutorials we have in this area. What the sample is is a mini-scandisk application. You know, the kind of thing you can ask to look for obsolete files and clean them up, and that you might leave instances running on several machines so they can can do peroidic scans. And of course its instrumented with some JMX beans so you can control all the processes centrally from jconsole. Mwaa ha ha.

Did I forget anything ?...oh yes we started to dust off some of the older samples too. I'm afraid that the sample code in the JDK hasn't always kept apace of the new features in the language. But take a look at the source code in the 2D Demo - best viewed in NetBeans - and you'll see we're very much more up to date. Props to Nicholas (get-a-blog) Sterling for that.

We hope to do more in future releases. And Lance, I know you're busy, but don't forget I'd love a nice JDBC sample too. I'll have my people call your people...


swing is so ugly. and that gui is an especially ugly example. great way to show all off the new bloat.

Posted by gareth on October 21, 2006 at 06:25 AM PDT #

Hey, I just saw that you've submitted JSR 308, and it has the following paragraph: "The JSR process will be run in an open and transparent way, with drafts, discussion, and progress reports available for public view and comments via and our own websites." I believe this is the first time Sun has committed to leading a JSR on J2SE in that fashion, so thank you very much for doing it. And good luck with the review process, the idea is nice, and should tie in very nicely with JSR 305.

Posted by Dalibor Topic on October 28, 2006 at 12:55 AM PDT #

Post a Comment:
Comments are closed for this entry.



« April 2014