Thursday October 12, 2006
Sampling Java SE 6 Features
Filed under:
javase6
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.
|
Scripting
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.
JMX
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...
Posted by dannycoward
( Oct 12 2006, 05:37:48 PM PDT )
Permalink