Skip to main content

JavaFX 1.0 is here: On your desktop, in your browser, and on your mobile phone

Posted by terrencebarr on December 6, 2008 at 6:06 PM PST


Save the Date


Updates:

  • See Jeet Kaul's blog "JavaFX - The road ahead"
  • Running JavaFX applications on real devices (see below)
  • Check out this video with Jacob Lehrbaum, Sr. Product Line Manager for JavaFX Mobile

JavaFX 1.0 is here!

JavaFX is the expressive platform for creating and delivering rich Internet experiences across all the screens of your life: for web browsers and desktops - and (in preview) for mobile phones.

Today's JavaFX 1.0 release includes these components

  • The JavaFX development environment including the FX Script compiler and runtime tools, graphics, media, web services, and rich text libraries
  • NetBeans 6.5 with JavaFX
  • The JavaFX Production Suite
  • The JavaFX Desktop Runtime
  • The JavaFX Mobile Runtime (in preview)

What's unique about JavaFX?

  • JavaFX allows developers to create expressive rich Internet applications quickly and easily across multiple screens, including mobile phones, desktops, televisions, and other consumer devices
  • JavaFX provides a unified development model for building rich client applications that integrate immersive media - audio, video, vector graphics, rich text and web services
  • JavaFX features a suite of designer and developer tools that enable an efficient, productive and iterative designer-developer workflow
  • JavaFX combines the best capabilities of the Java platform with comprehensive, immersive media, graphics and JavaFX Script – a simple and intuitive scripting language

Because JavaFX leverages the power and pervasiveness of the Java platform JavaFX will run most everywhere Java is running today - including mobile devices.

On the Desktop. In the Browser. And on your Mobile Phone. Same code everywhere.

Ok, show me! ... glad you asked ;-)

Let's try out a simple but useful example of a JavaFX application with a nice little GUI that accesses a web service (Yahoo! Local Business search). You can deploy and run this application (using the exact same unmodified application code) on your desktop, within a browser, and on the mobile emulator (as well as on many MSA-compliant phones - coming soon) with the touch of a button. It will give you a good idea what JavaFX is and how to get started with it.

I will be doing a screencast on this and other demos soon but for now here are the step-by-step instructions:

FXLocalSearch.jpg

  • Step 1 Download the latest Java 6 SDK Update 11 and install it
  • Step 2 Download the latest NetBeans 6.5 with JavaFX 1.0 bundle ("Download Now") and install it
  • Step 3 Start NetBeans 6.5
  • Step 4 Create a new project called "Local Search" from the built-in samples (NetBeans menu: File>New Project>Samples>JavaFX>"Local Search") and hit "Finish" in the dialog to create the project
  • Step 5 In the NetBeans "Project View" panel, right-click on the "Local Search" project and select "Properties". In the "Project Properties" dialog select the category "Run" and make sure "Standard Execution" is selected. Click "OK"
  • Step 6 In the NetBeans toolbar click the big green run triangle (run button).
  • Step 7 After a few seconds you will see a little window come up titled "Coffee Shops (1 of 5)". Here you can punch in a zip code and search for coffee shops in that location. The application actually does a RESTful web service call out to Yahoo! to retrieve live information. Clicking on the right and left arrows scrolls horizontally through the list of search results. Finally, hit the "X" close button.
  • Step 8 Now run the same application in your web browser. In the "Project Properties" dialog (step 5) category "Run" now select "Run in Browser" and click "OK"
  • Step 9 Again, click the run button in the NetBeans toolbar. After a few seconds a browser window will open, load the applet, and present the exact same application as before - but now running in your browser. No changes to the application code were necessary.
  • Step 10 Now run the same application in the mobile emulator (sorry, at this point the mobile emulator is only available on Windows - so Mac users can't do this step right now). In the "Project Properties" dialog (step 5) category "Run" now select "Run in Mobile Emulator" and click "OK".
  • Step 11 Hit the run button in the NetBeans toolbar. After a few seconds the mobile emulator will open and the application is loaded. Again, we see the exact same application as before - but now running on a MSA-compliant emulator. Again, same application code as before.
  • Step 12 Open the file Main.fx in the NetBeans editor and browse the code to get a feeling for the anatomy of a JavaFX application.

As you can see JavaFX is a whole new ball game with many new exciting features and possibilities. I'll be talking about this and more over the next couple of weeks - especially with a focus on mobility.

Finding out more

Have fun playing with JavaFX!

Cheers,

-- Terrence

PS: For Linux and Solaris support see the JavaFX blog.

Update regarding running JavaFX applications on real devices

I spoke too soon regarding the ability to run the resulting JavaFX app not only on the mobile emulator (as in step 11) but also on off-the-shelf MSA-compliant devices. Running on phones was supported in internal prerelease versions of the tool chain but that feature is a work in progress and was not considered ready for the JavaFX 1.0 release - so it was removed. Unfortunately, I got mixed up with versions and it looks like I tested my instructions using a prerelease version ...

So, for now at least, running on real devices is not supported. But let me ensure you

  • It works (I'll post some videos as soon as I get around to it)
  • It's coming very soon - we in the process of completing the functionality and adding performance tweaks

In the meantime I encourage you to start experimenting with JavaFX Mobile using the emulator - it's where the platform is going. Sorry for the confusion and stay tuned.

Related Topics >>

Comments

Biswajit,

Sorry for the slow reply. See Jeet Kaul's answer on his blog http://blogs.sun.com/meetjeet/entry/javafx_the_road_ahead:

5. Do you have plans to reduce the desktop FX runtime's dependency on Swing? Yes we will be adding new UI controls and widgets that'll be based on the common profile of the JavaFX platform. This will remove dependency on Swing and allow the UI components to be used across all devices. We will, however, also provide a better integration for existing Swing applications separately.

Hope this clarifies it. Best,
-- Terrence

I have one doubt about that 'all screens' claim. Java FX, I find, allows Swing classes to be imported. So if I write code that uses Swing, how will it run on a mobile platform? And talking of Swing, is there any possibility of having LWUIT integrated into FX? Biswajit

Jaxer,

Absolutely - keeping the developer community informed about everything mobile JavaFX is a big part of what I will be doing. And feeding input and feedback back into Sun. Much more to come over the next weeks and months.

-- Terrence

No problem, Terrence, I was suspecting that somehow. It'll be nice if you can update us on the situation, or maybe give an early access to the SDK builds. I think I'm not the only one who's eager to test this on real devices. Also, a list of the required JSR's would be nice as, apart from Sony Ericsson java platforms, the market is quite fragmented. Thanks again for checking.

Ok, I've figured out what went wrong. Of course, you guys are right ... I evidently used a prerelease version of the JavaFX 1.0 SDK for my instructions. Please see the updated section at the bottom of my blog ("Update regarding running JavaFX applications on real devices").

I apologize for the confusion.

-- Terrence

Let me double-check that. I ran multiple FX Mobile applications that I built with NB 6.5 on my Sony Ericsson W910 demo device. I'll try reproducing this tomorrow - maybe I mixed up something in the rush of the last couple of days. Sorry about that. -- Terrence

Of course it won't run ! Can you tell me how an MSA-compliant phone is supposed to have the javafx.* and com.sun.javafx.* packages ? I first thought that the netBeans JavaFX plugin was taking care of this by including the JavaFX mobile libraries or by rewriting portions of the JavaFX code to JSR-226 calls, but apparently it's not. The bytecode is left as it is, with minor changes (i.e check if the Double class is there before using this type / CLDC 1.1). Let alone the JAVAFX-1.0 profile... Terrence, did you follow your own step-by-step instructions ?

Hi Terrence, I ran the sample, and found this in the JAD: MicroEdition-Profile: JAVAFX-1.0. We will have to wait for compliant devices? oh boy!

I actually tried running the jar for LocalSearch on my phone, didn't even install. I watched Jacob's video, and I have the same phone he's demoing with (SE w760). sooo... what do i have to do to actually run this on my phone? i just followed your steps here. I'm really anxious to try javafx out on my phone.

Quite disappointing I must say to look at the samples advertised on the Java FX site. It seems to suggest that neat graphics tricks (blurring, shuffling rectangles, rotation, scaling etc.) is all that JavaFX provides. There is perhaps a small set of people in the intersection of two sets: nerdy Java programmers who want to be graphical designers, and graphical designers who aspire to be programmers. JavaFX should really appeal to this set.

On Linux support: Please see the javafx blog at http://blogs.sun.com/javafx/entry/a_word_on_linux_and

... and it still doesn't support Linux...