JavaFX Q&A

To learn more about the technical aspects of today's launch of JavaFX including its support in NetBeans and Eclipse I spoke in depth with Eric Klein, VP of Java Marketing at Sun, and Octavian Tanase, Senior Director of the Java Platform Group. For a more business oriented perspective see the interview with Jonathan Schwartz.
Written by Ed Burnette, Contributor

To learn more about the technical aspects of today's launch of JavaFX including its support in NetBeans and Eclipse I spoke in depth with Eric Klein, VP of Java Marketing at Sun, and Octavian Tanase, Senior Director of the Java Platform Group. For a more business oriented perspective see the interview with Jonathan Schwartz.

[ Read: Sun launches JavaFX 1.0, and Schwartz: Three reasons you need JavaFX ]

[Ed] Q. What is Sun announcing today?

[Eric] Today we ship JavaFX for the desktop. This is the culmination of a couple of years work from us. It's a major innovation in the Java space related to enabling developers to create really rich, immersive media applications across browsers, desktops, mobile, television, you name it.

[Octavian] You've recently covered the release of Java 6 update 10, which laid the groundwork for a lot of this development to be able to take place on the client side, so this will fit right in.

[Ed] Q. What is JavaFX?

[Eric] The way to think about JavaFX is that from the beginning FX was designed and built in Java, it runs on top of Java, so the announcement we did previously around Java 6u10 and the amazing things we did with performance and applets, were all designed to be sort of the foundational piece for FX. FX layers on top of Java, and it's designed to provide Java with an amazing presentation layer. It's also an application framework for future applications.

Next: A new paradigm for developers >

[Eric] The real driver for us is Java's ubiquity. It's been doing incredibly well in the marketplace: 91% of all Internet connected PCs and 2.2 billion phones. The thing that developers have been asking us for is that nowadays to build a compelling user experience, rich media and interactivity is really the key to that. We see that on the web, the transition to Ajax, we've seen it in gadgets, literally everything has become incredibly expressive.

As part of that there's this new class of, I call them a new class of developers, a whole new group of people who have joined the development process. Folks like web designers, people who are used to working in Ajax or PHP or Ruby, and graphic designers, who are an integral part of the design and development process right now. I remember when I was just a programmer years ago I did all my own art. That just wouldn't happen as much anymore; it's great to have folks who are comfortable in Photoshop and Illustrator.

All these people come together now to build great web sites, to build widgets, to build applications. What we wanted to do was make sure we added the right components to Java to facilitate that transition, this groundswell of new development techniques.

We did FX because we knew that the way software was developed, whether it was done for a browser or for the desktop or for multiple screens had fundamentally changed over the last few years, both in terms of who does the development and in the type of application that's being built now.

[Ed] For people like me, it would be great if you could include a graphic designer in the box with it.

[Eric] I wish I had spent more time in school studying the graphic side of things so I would have been a better program artist, but yeah, that's the trick now is you see that so much, that the graphic designer is an integral member of the design team.

The interesting thing is I speak one language as a developer, which is like an object driven model, and when I talk to my designer friends the're all like "Oh, dude, it's about the timeline, and I start the animation here and end it there". So you see these two worlds interacting but it's a very different paradigm between the two of them. Our goal was to try to bring these two disparate groups together. We've got 6.5 million Java developers, but there are over 8 million creative professionals.

Next: Bringing two worlds together >

[Eric] One of the ways we accomplish that is through JavaFX script. If a developer or web designer is familiar with something like JavaScript or ActionScript, when they take a look at FX script they go "Ah, I get it". We took some of that very simple and easy to understand scripting language and layered all the power of Java behind it and then added a bunch of new functionality around simple controls for things like animation, 2D graphics, high-res audio and video.

Previously the way to get to the power of the Java virtual machine was that you had to write in Java. We've got millions of Java developers that do it, but we wanted the web designer to have access to the power of the JVM wherever it was, but in a simpler form.

A classic example is Java Swing, which is very powerful but you really have to have a computer science background to take advantage of it. Whereas from a web designer's perspective they want to open an object with one call, transform it in another call, change its color and maybe opacity, all in scripting. So we built FX script from the ground up to expose all this power in a way that's really simple.

We're really proud of the language because some of the things it does have never been done before to make it easier to program.

[Octavian] The programming model is very different from what people are used to seeing in Swing. It's a scenario based programming model. Web developers will also be pleased to see there's a JavaScript to JavaFX Script bridge that enables you to call from JavaScript functions to JavaFX Script methods. This achieves a level of interoperability between Ajax and JavaFX applications, a seamless integration that allows FX applications to operate in a web page.

[Ed] Q. In the preview you had Project Nile, do you still have that?

[Eric] It's now called the JavaFX Production Suite and we're shipping it with version 1.0. It's a critical piece of the puzzle because that allows folks who are using Photoshop or Illustrator to do a one-click export to get their assets out of Creative Studio and into FX in NetBeans so they can use it right away. I love it because from Illustrator I can have, with one click, an SVG file, and then immediately manipulate it in code. Then the developer says "I wish it would do so and so", yells it over the cube wall, and the designer changes it and exports it again. Bringing the developer and the designer together is a critical part of the equation.

From the developer's side, for the first time they have very simple animation in Java. JavaFX Script has full animation support, keyframe support, all the things you need to manipulate these types of objects in a really easy way.

[Octavian] To take the point further, we have a series of plug-ins that you can use in Illustrator and Photoshop and you can export your assets to an intermediate file format that can then be easily used in either a NetBeans or Eclipse project to enable you to further add business logic to manipulate those assets.

Next: An Eclipse plug-in, from Sun? >

[Ed] Q. How good is the developer support in the major IDEs?

[Octavian] We started with NetBeans a while ago and we've achieved very good integration of JavaFX Script into the IDE itself. It's close to what we've done with Ruby in NetBeans.

We've recently also built an Eclipse plug-in which is a little younger than the NetBeans one and we'll keep on adding features. You don't have some of the advanced functionality that you'll find in NetBeans yet but we're open sourcing this project and we're going to bring more Eclipse experts on board that will likely continue to evolve the support of JavaFX Script in Eclipse.

One of the things that developer tools help you do is to unify both the development and the deployment models. One of the things you'll likely be able to do is use a menu just before run time to choose the deployment configuration for your application: desktop, browser, mobile emulator, or in the future TV or others.

[Ed] Q. Is JavaFX still planned for mobile devices early next year?

[Eric] Yes, the great news is that, for launch, we'll be bundling in the mobile emulator. This will allow developers for the first time to not only build and deploy FX applications for the desktop but also test those same applications in mobile.

What we've done is, we've designated something known as "FX Common" which is a series of APIs that allows a developer to know that their application will run across all FX implementations.

So they will be able to, for the first time, write an application on the desktop, deploy it on the desktop, and test it in the mobile emulator. Our plans continue to be to make more announcements around JavaFX mobile in early 2009  [Mobile World Congress is coming in February, hint, hint--Ed]. Given the 2.2 billion phones with Java on them we want to get JavaFX on to mobile as quickly as possible.

Next: What about the iPhone? >

[Ed] Q. Would that include the big 3, the Apple, RIM, and Android phones?

[Eric] Our general statement around mobile phones, and this would be inclusive of JavaFX, is that our goal is to have the Java runtime on every major phone platform, where it is possible to create an arrangement with the partner that owns the platform. So as an example, RIM is a Java licensee and the RIM platform (Blackberry) is based in Java. We publicly demonstrated JavaFX running on Android, and of course we have a strong relationship with Apple around Java but the particulars of Java on the iPhone is something that we're not publicly discussing.

[Ed] Q. Do you have any examples of JavaFX wins on major sites?

[Eric] We aren't announcing any particular deployments of it [because it just came out]. Our goal over the last 6 months--we released a preview in late July--was to get developers just started on JavaFX. We've had thousands of developers around the world download the SDK. We're very excited by it but this is just the beginning, this is the 1.0. This is the first day anyone could go into production with JavaFX. I think you'll see more announcements about sites using FX after launch. There are folks working with us who'll be announcing support for JavaFX but it's like the situation with our licensee partners: we don't make the announcement for the licensees, so they need to make their own announcements around it.

[Ed] Q. What media codecs will be available on all desktop systems?

[Octavian] We're using the codec from a company called On2, and that will enable us to deliver cross-platform media to Mac and Windows. That's the VP6 codec.

[Ed] Q. Will we ever see cross-platform H.264 (AVC)?

[Octavian] I think in the near future you will see that.

[Eric] The way we built JavaFX, it's as much of a business decision and a partner decision around which codecs to bundle in. There's no technical limitation from that perspective. It's just that we felt like for our initial launch that bundling the same basic codec that powers Flash, and allow developers to maintain consistency of the media format, was really important to us. Going forward, depending on business and licensing arrangements, and what our partners are asking us for, we can add different codec environments.

Next: How open is open? >

[Ed] Q. To what extent is JavaFX open source?

[Eric] There are parts of JavaFX that are already open source today.

[Octavian] The compiler....

[Eric] The compiler is already open source, and part of our tools. Going forward, as we get the environment up and out, and we understand a little bit more about exactly what developers are looking for, we'll be making future decisions about FX, what goes into open source or not.

As you're well aware, in general we're hyper committed to open source. Open source is the key foundation of our software strategy, and all of Java is in open source. We'll continue to evaluate as FX starts to mature, getting more and more parts of it into open source as well.

[Ed] Q. With Flash, Adobe doesn't allow people to distribute their own players. Will you?

[Eric] Today we control that distribution. One of the big things that we've been working on is making sure that Java developers can reliably build one source base and have it run on as many devices as possible. FX is a significant step forward with that. The statement we're making to developers is that if you write code in JavaFX it will run across JavaFX implementations.

We've had tremendous wins recently with partners, where we've started to build the binaries, the JVM, for more and more mobile devices. What this helps us to ensure is that as a Java developer, when you write your source code that it will run. We've taken the Java fragmentation issue very seriously over the last two years, so we've taken a number of steps to ensure that from day one, you don't have to deal with fragmented FX releases. That's critical to us because while Java has been incredibly successful in terms of overall number of deployments, developers and partners have been asking us to make sure as much as possible that they can just write one app. I want to do as little divergent testing as possible, and then get my application out to as many different seats, and as many different screens as possible.

Another thing developers have been asking, is I really do want to make an application that starts in the browser and I drag it off into the desktop and it still runs. And it would be amazing if I could run that same application on the mobile phone. If I want to make special code additions to make the mobile version unique I could do that, but if I didn't I would like my one binary to run. That was one of Java's original goals, "WORA" - write once run anywhere. With FX we're really watching how we do the distribution and how we manage our open source so that we can give the developers and our partners that almost number one request of theirs which is reach, but reach that's common, one binary.

With that in mind, we look at that and say that we're going to marry that with open source to get the maximum value for our developers and our partners.

Next: JavaFX squares off against Flash >

[Ed] Q. When would JavaFX be a better choice than Flash/Flex?

[Eric] This is one of the things we're most excited about. We have nothing but a tremendous amount of respect for Adobe and the work that they've done over the years. In fact, some of the original members of the Macromedia Flash team are here working with us. I always start by saying that, hey, they've been doing this a very long time.

For us though, when you look at Flex, when you talk to a lot of Flex developers what you find out is that a lot of them are Java developers. What they say is, I really wanted to continue to work in Java because Java is where I do all of my business logic. The challenge that I had previously is that I couldn't do these rich immersive environments in a really rapid fashion. It was harder to do that for them [in Java]. So Flex was appealing to them from that perspective. It gave them the user interface but since it was still rooted in Java in a lot of ways it gave the developers a transition.

FX squarely helps those developers.

One of the key things we're finding is that Java developers, once they start using FX Script, the vast majority of them say that they'll never go back to straight Java code because there are things they can do in FX that they've never been able to do. It's about efficiency. Something that used to take them a hundred lines of code now takes them four or five lines of code. For a developer, as you're aware, it's all about efficiency.

So what we've done is we've told the Java developer community, if you need to build rich, expressive applications, for instance enterprise dashboards, CRM apps, and so forth, you can do that with Java now. FX gives you that power that you were previously maybe drawn a little bit to Flex to get. So that's a big difference, when you want to build an expressive environment but still have all the power and everything you're comfortable with in Java. Remember, you can always call Java.

[Octavian] If you have an investment in Java you're very likely to invest in JavaFX Script. You'll be able to use Java to leverage your process connection to devices and networks, and to do complex computations. The bridge with JavaScript and Ajax is there at your fingertips, the tools are there, and integration with web services is also something that's very handy to the JavaFX Script developer.

Next: Come back to the Java side, we have cookies >

[Eric] For instance we were just at Adobe MAX, and had a great session there. A lot of people were amazed coming over, saying wow, this is exactly what we've been looking for. They said, we've been using Java for a long time but we felt like we needed to look at Flex because of the types of applications we wanted to build and just how fast and efficient we could be with in our development time. So that's what we're most excited about, is for the Flex community [to reconsider Java].

[Ed] Q. Are there any apps where Flex would be a better choice than JavaFX?

[Eric] We feel that with FX 1.0, for the type of applications people build with Flex, that we've provided a very rich environment. Between the JavaFX production suite, JavaFX Script, and of course being able to take advantage of Java, that that development community can really build the type of applications that they want to build now in Java, never leaving our environment.

For more information see the JavaFX web site, or our other coverage on the launch and an exclusive interview with Jonathan Schwartz.

Editorial standards