Sun's JavaFX Takes On Flash, Silverlight

by Scott M. Fulton, III

May 8, 2007, 3:53 PM

At this morning's session of the JavaOne conference in San Francisco, executives of Sun Microsystems are expected to announce the near-term availability of a version of Java exclusively geared to rich Internet application (RIA) developers. Commandeering Microsoft's leftover, unused brand name (".NET FX"), Sun is said to have dubbed this new system "JavaFX."

Its target market, based on information Sun gave exclusively to the trade press and which was leaked early, will be the developers of Web-enabled applications outside the browser. Although that was Java's target market to begin with, Sun appears to be concentrating on the portable graphics developer, in an attempt to fill in the gaps between Java and Flash. In recent years, Adobe's Flash has become the platform of choice due to its ability to scale graphics onto multiple devices, which is now beginning to include cell phones and handsets.

As part of the suite, Sun is expected to announce a new and perhaps initially bewildering embedded language called JavaFX Script - not JavaScript, not ECMAScript (one standardized form of JavaScript), not AJAX (Asynchronous JavaScript). This may be the culmination of what had been called "Project Flair," which could perhaps be described as JavaScript if Java's creators had created it.

Previous attempts by Sun's marketing people to describe Flair without giving away the secret, have led to some confusion. It will be interesting to see, for instance, whether JavaFX Script is actually written in JavaScript as had earlier been suggested (which might make things a little slow) or run as a separate kernel from Java altogether, which would seem on the surface to defeat the whole point of attaching a scalable vector graphics model onto Java in the first place.



Update ribbon (small)

3:45 pm May 8, 2007 - As it turns out, JavaFX Script is a scripting language utilizing a subset of Java concepts, mixed with some new concepts that substitute for their more object-oriented counterparts. The result is a purely procedural language that is biased toward the production of graphic objects, and the input and output of data.

Its strong point is the facilitation of exchanges between server and client over the Web, but the language itself is almost a throwback to the ALGOL-derived languages of the 1970s and early ‘80s. It’s less object-oriented, and more pragmatic.

For the most part, JavaFX resembles JavaScript (which was originally developed outside of Sun, for Netscape) more than it does Java. As with JavaScript, you declare variables using the var keyword; and while you should declare variables, they’re not necessarily explicitly typed. In other words, the interpreter can determine for itself whether a variable whose initial value is set to 0, should not be an alphanumeric string.

Furthermore, if you declare var iValue as equal to [1, 2, 3], the interpreter can determine for itself that iValue is an array. And like JavaScript, JavaFX uses the import statement to borrow classes directly from a Java library.

But aside from JavaScript’s familiar syntax of declarative instructions closing with semicolons, the JavaFX language branches off on its own, proving decisively that it’s not JavaScript. For example, its handling of arrays and lists is more like a database, with instructions like insert [4, 5] as last into iValue; which is a very straightforward method of appending entries at the end of an array.

Further, the language actually makes use of predicates - a concept typically used in database languages – for declaring criteria for entries from an array that should be deleted, as in delete iValue[. >= 4]; Here, everything in the square brackets acts as the predicate – the criteria for which deletion should take place, in this case, everything greater than or equal to 4. The period acts like a reflexive operator, or like the old DOS symbol for “this” when referring to “this directory.”

JavaFX Script (a.k.a. “JavaFX,” according to Sun) programs can run within the existing Java 1.6 kernel. We tried a few demos ourselves this afternoon, which ran without our having to have modified the Java kernel ourselves first. Rather, the kernel downloaded the extensions needed for it to handle scalable vector graphics in the background.

Rather than rely on multiple inline references to Java graphics libraries, JavaFX refines the graphical framework. It does not embed anything in a Web page. Rather, it enables you to declare functional graphic elements using a fairly self-explanatory and non-confusing syntax...that is most definitely not JavaScript, or anything like it.

In practice, a JavaFX-enabled program could take the place of a rich Internet application developed using AJAX, or using the scalable vector graphics toolkits for Flash and Silverlight (which are both generally dependent to some degree on AJAX anyway). But the fundamentals are different. Typical RIAs are constructed in such a way that the HTML page acts as a substrate for the graphical or text objects with which the user interacts. No such HTML substrate exists in JavaFX.

Instead, in an almost uniquely unremarkable fashion, graphic objects are declared like variables, and attributes are assigned to them individually. The syntax is structured and tabulated, rather than jumbled together like an inline instruction, so the newcomer can assimilate the basic principle of how to declare an object without having to memorize which term corresponds with what attribute.

Here’s a simple example of a JavaFX function that plots a red circle:

Canvas {
content: Circle {
cx: 80
cy: 80
radius: 50
fill: red
stroke: red
strokeWidth: 2
}
}

The staggering of attributes onto individual lines, while probably optional, is quite intentional. It enables developers to get a better handle on the attributes of objects, in what may prove to be a far more intuitive way than with CSS.

Conceivably, just before the declaration of the Circle object, the statement filter [] could be added, setting up an array for Photoshop-like filters to be applied to the object, or to whatever Group of objects are declared within. So if you expand the filter array, for instance, to include filter [ShadowFilter], you immediately create the default drop-shadow for the declared object.

Veteran Java programmers will note that, at least for now, JavaFX makes use of graphic objects borrowed from the realm of Swing, Sun’s 2D graphics library.

So here’s how the RIA scene stacks up at present: With the advantage of the biggest installed base is Adobe Flash, which racks up the lion’s share of scalable vector graphics applications on the Web. While Adobe is expanding the Flash system with the Flex environment, its language is based on an embedded XML schema that remains browser-dependant.

Microsoft answered the challenge last month with Silverlight, a .NET subset that can run in Linux and Mac OS, which teases developers with compatibility with its ASP.NET AJAX version, but then tries to lure those same developers into the broader realm of .NET development with applications languages like C#. It starts out browser-dependent, but in full fruition doesn’t have to be.

Coming from the opposite end of the field is Sun’s JavaFX, which builds on the Java platform by creating a new language that the same interpreter can execute (just like the .NET Framework can interpret multiple languages), that tries to be JavaScript the way Sun would have done it from the beginning.

But Sun’s objective is to try to yank RIAs off the browser as much as possible, moving clients into a realm where they’re no longer dependent upon Microsoft or open-source groups to keep the technological ball rolling. It is a very interesting time indeed to be a Web developer.



A JavaFX rendition of Motorola's 'Studio Moto' site, which is rendered elsewhere using Flash.A JavaFX rendition of Motorola's 'Studio Moto' site, which is rendered elsewhere using Flash.

Add a Comment

21 Comments

Name E-mail

Betanews reserves the right to remove any comment at any time for any reason. Please keep your responses appropriate and on topic. Foul language and personal attacks will not be tolerated.

Am I the only one who finds it hard to get excited about anything with "Java" or "Sun" in the title? It's a great idea and all, but about ten years too late. Also, in my mind "Java" has become synonymous with "bloat".

Score: 0

|

20th!

Score: 0

|

Gaack!

That was soup about 10 ingredients ago.

Score: 0

|

The article states, “While Adobe is expanding the Flash system with the Flex environment, its language is based on an embedded XML schema that remains browser-dependent.”

This is a complete fallacy if I’m reading it correctly. Yes, you can host uncompiled mxml on Flex Data Services, but that would be the exception not the rule. Core to the Flex paradigm is the fact that it is NOT browser-dependent. The xml schema is simply a language of convenience which ultimately runs as ActionScript behind the scenes, and normally ends up compiled. A swf can not only be shown directly in a browser, with no supporting html, xhtml, xml of any kind, but then there’s Apollo.

Score: 0

|

I think the biggest problem is that the java runtime is not consistent across platforms or even vendors.

I don't know if it's still the case, but for a long time, Sun's own Java interpreter could not pass the standards test to prove that it handled everything it was supposed to.

And then there were issues with some things working properly under one platform, but failing under another - because the interpreters were written by different companies and had their own share of bugs.

So if I have IBM's java interpreter running and try to use this JavaFX, will it work 100% or will I need to install Sun's version as well, just to run this?

I know that under Java development, trying to port an app that was written for say one JSP server and then try to run it on another was always an exercise in hair pulling.

No one implemented anything consistently and I'm hoping that this isn't going to be the case here. But....

Score: 0

|

This sounds like a 50 Lb kid jumped in the ring to take on two 500 Lb kids.

Score: 0

|

Something tells me when the dust settles we'll all still be using flash.

Score: 0

|

Just my sentiments.
No sane person uses Sun's Java garbage due to its voracious memory hunger while still being slow as hell (not to mention being a pain to program).
It won't be any different with this crap.

Score: 0

|

the question is whether this a zero sum game.

Score: 0

|

I hope Sun is not betting the farm on this one. I'm a bit disappointed actually, I would have expected that a minimum they would have demo'd a sample of the environment, cant feel but feel its a hastily assembled product with an equally abstract goal.

Score: 0

|

Great, loads of "standards", none of them standards...

The winner of course, will be the one that supports the most browsers on the most platforms..

Currently, this is Flash..

Score: 0

|

Great, another Flash type language plugin that's going to need installing to access certain sites.

Hopefully it'll die a quiet death.

Score: 0

|

This whole JavaFX stuff somehow resembles an older package from Macromedia called Director. And Director was an outstanding multimedia authoring tool. Too bad that Macromedia and now Adobe stopped developing Director further and concentrated completely on Flash (not to say that Flash is bad).
One interesting question that I have: will JavaFX system replace Swing based desktop applications? Is that an intention here or just create a JVM based multimedia authoring tool?

Score: 0

|

If i didnt dispise Java so much for the way it slowed down my computer to death for crappy java based apps, I'd actually be excited about this.

Score: 0

|

Add another language to the fire. Lame.

Score: 0

|

Yes, how could several different ways of doing the same type of thing ever be useful?

/sarcasm

Competition = better products. Let's throw a few more in there.

Score: 0

|

in general i agree with you ... but Sun of all competitors?

who's next? Real?

Score: 0

|

EMCAScript was the basis of javascript, not the other way around if I'm not mistaken. I believe this was also the subject of several lawsuits regarding microsoft and netscapes use of embedded script technologies in their browsers based on the principles of EMCAScript. That's just my understanding, my mind might be going.

Score: 0

|

NULLedge, you are mistaken.
Netscape invented the scripting language with syntax resembling Java around 1996 and called it LiveScript. Then Netscape renamed it JavaScript - with requested and received Sun's blessing. That renaming was done for marketing purposes because of skyrocketing Java popularity.
Then - much later - Javascript was presented to the European manufacturing standards organization ECMA for creating a world-wide standard for JavaScript. The standard was created and it was called ECMAscript.

Score: 0

|

And just to fill in a few extra details for kicks - if I recall everything correctly.

Mocha/LiveScript (now JavaScript) was by Netscape in 1995. Microsoft developed the competitor JScript in 1996.

It was Microsoft who then submitted the JScript specification to ECMA for standardization late 1996.

Score: 0

|

then its a good thing i did indeed declare that i may be wrong in saying "..."

to clarify, i was referring to this:

http://www.reddnet.net/Scribbles/435.aspx

Score: 0

|

Audiovox flashback features Elvis and rabbit-ears

Elvis! The season's first sighting of the King occurred at the Audiovox press...

Live from the Cisco press conference at CES 2009

Known worldwide as an infrastructure company, Cisco now plays a bigger role...

Toshiba focuses on mid-range DTV for everyone

Toshiba's press conference at CES 2009 this morning featured announcements in...

LG unleashes its annual flood of announcements

Holding down its traditional CES-opening spot at 8:00 am, LG on Wednesday ran...

Netgear debuts a BitTorrent-enabled set-top box

The first of NetGear's three big product announcements at CES this morning is...

Live from the LG press conference at CES 2009

Speaking to an overflow crowd in Las Vegas Wednesday morning, executives from...

CES Unveiled event provides a high-energy opener

If CES is a banquet, CES Unveiled -- the opening press event -- is like a...

Going green with iGo by eliminating 'vampire power'

At CES this week, iGo will introduce a surge protector, a laptop charger, and...

Pocket-sized music player / mixer to make North American debut

This week's CES show will mark the North American rollout of a handheld...

PowerMat intros an innovative battery charger

At CES this week, a company called "The Power Mat" will roll out a slick...

First look at Novatel's MiFi wireless hotspot

At the CES Unveiled press event tonight, Novatel Wireless gave a first look...

New Asus netbooks will feature Windows 7

UPDATED At a press conference at CES 2009 Tuesday evening, Asus introduced...