Pro JavaFX 2 Platform Book Is Available: eBook Now, pBook In Two Weeks
JavaFXpert on twitter: Pro JavaFX 2 Platform book publishing 07.mar.2012, but available now as eBook. Source code available now as well: apress.com/9781430268727
The updated version of our (Jim Weaver, Stephen Chin, Dean Iverson, Johan Vos and me) JavaFX book by Apress, Pro JavaFX 2 Platform, is finished. The paper book will be available on March 7, 2012. You can get the eBook now through the "Buy Alpha Book" program. The source code of the book is also available at http://www.apress.com/9781430268727.
Here's the back cover description of the new book:
In Pro JavaFX 2: A Definitive Guide to Rich Clients with Java Technology, Jim Weaver, Weiqi Gao, Stephen Chin, Dean Iverson, and Johan Vos show you how you can use the JavaFX platform to create rich-client Java applications. You'll see how JavaFX provides a powerful Java-based UI platform capable of handling large-scale data-driven business applications.
Covering the JavaFX API, development tools, and best practices, this book provides code examples that explore the exciting new features provided with JavaFX 2. It contains engaging tutorials that cover virtually every facet of JavaFX development and reference materials on JavaFX that augment the JavaFX API documentation. Written in an engaging and friendly style, Pro JavaFX 2 is an essential guide to JavaFX 2.
What you’ll learn
- How to get started with JavaFX 2, including downloading the SDK and available tools.
- How to express user interfaces with a declarative-style enabled by the JavaFX builder classes.
- How to use property binding to keep the UI easily in sync with the model.
- How to use the rich set of JavaFX UI controls, charts, shapes, effects, transformations, and animations to create stunning, responsive, user interfaces.
- How to use the powerful JavaFX layout classes to define the user interface in a cross-platform fashion.
- How to leverage the observable collection classes to observe changes in, and bind to, Java collections.
- How to use the JavaFX media classes to play audio and video.
- How to interact with external application services to create an enterprise application with JavaFX.
- How to use the JavaFX API with alternative languages such as Scala, Groovy, and Visage.
- How to uncover the JavaFX APIs to whatever degree you choose. The tutorials, reference materials, and pointers to resources are exhaustive.
I hope the book will help you learn JavaFX quicker, have fun playing with the JavaFX 2 APIs, profitably produce compelling rich applications on the Java platform.
Running 32-bit JavaFX 2.1 Beta SDK On 64-bit Ubuntu 11.10
[Update Thu May 17 22:50:34 CDT 2012] Oracle made 64-bit Linux version of JavaFX 2.2 Developer Preview available when they released JavaFX 2.1 last month. There is no more need to follow the procedure below. You can simply use the 64-bit JDK 7 Update 4 together with the 64-bit JavaFX 2.2 beta to do your JavaFX programming on 64-bit Linux systems now.
[Update Fri Feb 3 21:59:05 CST 2012] I started this blog a few days ago with the goal of playing JavaFX videos on 64-bit Ubuntu Linux. It turned out to be a longish post. So I'll just put the result here at the top, showing one of the video playing JavaFX 2 program at work. (This is an example from the upcoming Apress book Pro JavaFX 2 Platform. It's written by Dean Iverson. Thanks Dean.)
Tobias left a comment on the JavaFX 2.1 SDK Developer Preview Comes To Linux post 7 days ago:
Comment from Tobias on January 26, 2012 2:59:02 AM CST #:
Hi,
I think it is really nice to have an early preview of JavaFX 2.1 on Linux. However, I am also on a 64-bit Ubuntu and I cannot find out how to add the 32-bit libraries -- as soon as I try one of the 386 or multiarch versions, synaptics wants to remove hundreds of packages that I use daily.
I am really happy with JavaFX 2, which I believe is the best way to work with Java today -- but I am very tired of having to use VirtualBox and Win7 to get it working, so any help in installing the correct libraries would be great!
Let us hope that Oracle gives JavaFX on Linux the love it needs and deserves! I think they will.
According to the release notes, JavaFX 2.1 Developer Preview for Linux requires
- Ubuntu Linux 10.04 or higher (32 or 64 bit)
- JDK 6 update 26 or higher
- GTK+ 2 2.18 or higher
- libavcodec (for media)
Since the JavaFX 2.1 Beta SDK is 32-bit, I need 32-bit versions of the dependencies. On my 64-bit Ubuntu 11.10, I have already installed the 32-bit Sun JRE using Synaptic by installing the ia32-sun-java6-bin package. This package has a dependency ia32-lib which contains the 32-bit GTK+. There is no 32-bit Oracle JDK in the 64-bit Ubuntu's repositories, but it can be easily downloaded from Oracle's JDK download page. I downloaded the 32-bit JDK 7 update 2. With these software installed, I can start the sample programs such as the Ensamble.jar.
The dependency libavcodec turns out to be more problematic. Synaptic does show a libavcodec53:i386 package. But it is marked to be in conflict with the 64-bit version of libavcodec53. And if I choose to install it, 12 64-bit packages will be removed, including libavcodec53 and its dependencies, among them gnome. Apparently that is not desirable. Plus, the JavaFX 2.1 shared object that has a dependency on libavcodec is fxavcodecplugin.so. It is linked against libavcodec.so.52:
weiqi@gao:/opt/javafx-sdk2.1.0-beta/rt/bin$ LD_LIBRARY_PATH=. ldd fxavcodecplugin.so linux-gate.so.1 => (0xf76e1000) libgstreamer-lite.so => ./libgstreamer-lite.so (0xf75ec000) libgobject-2.0.so.0 => /usr/lib32/libgobject-2.0.so.0 (0xf7575000) libgthread-2.0.so.0 => /usr/lib32/libgthread-2.0.so.0 (0xf756e000) librt.so.1 => /lib32/librt.so.1 (0xf7565000) libglib-2.0.so.0 => /lib32/libglib-2.0.so.0 (0xf746c000) libavcodec.so.52 => not found libpthread.so.0 => /lib32/libpthread.so.0 (0xf7451000) libc.so.6 => /lib32/libc.so.6 (0xf72d6000) libm.so.6 => /lib32/libm.so.6 (0xf72ac000) libgmodule-2.0.so.0 => /usr/lib32/libgmodule-2.0.so.0 (0xf72a7000) libffi.so.6 => /usr/lib32/libffi.so.6 (0xf72a0000) libpcre.so.3 => /lib32/libpcre.so.3 (0xf7261000) /lib/ld-linux.so.2 (0xf76e2000) libdl.so.2 => /lib32/libdl.so.2 (0xf725b000)
So I have to somehow get the content of the package of the 32-bit libavcodec52, probably from an earlier Ubuntu release, without going through Synaptic, The easiest way to do this is through the Ubuntu Packages website. A few minutes of poking around reveals that libavcodec52 is available from Lucid Lynx (10.04), Maverick Meerkat (10.10), and Natty Narwhal (11.04). I choose to download it from http://packages.ubuntu.com/lucid/libavcodec52. I also downloaded all its dependencies (except libc6 and zlib1g, which I'm pretty sure is already part of ia32-lib. Here's the list of *.deb files I downloaded:
weiqi@gao$ ls -l *deb -rw-rw-r-- 1 weiqi weiqi 4470450 2012-02-03 20:42 libavcodec52_0.6.4-0ubuntu0.11.04.1_i386.deb -rw-rw-r-- 1 weiqi weiqi 78724 2012-02-03 20:41 libavutil50_0.6.4-0ubuntu0.11.04.1_i386.deb -rw-rw-r-- 1 weiqi weiqi 27556 2012-02-03 20:42 libgsm1_1.0.13-3_i386.deb -rw-rw-r-- 1 weiqi weiqi 16594 2012-02-03 20:43 libogg0_1.2.0~dfsg-1_i386.deb -rw-rw-r-- 1 weiqi weiqi 158080 2012-02-03 20:42 liborc-0.4-0_0.4.11-2_i386.deb -rw-rw-r-- 1 weiqi weiqi 255362 2012-02-03 20:42 libschroedinger-1.0-0_1.0.10-2_i386.deb -rw-rw-r-- 1 weiqi weiqi 112208 2012-02-03 20:43 libspeex1_1.2~rc1-1ubuntu1_i386.deb -rw-rw-r-- 1 weiqi weiqi 357600 2012-02-03 20:43 libtheora0_1.1.1+dfsg.1-3_i386.deb -rw-rw-r-- 1 weiqi weiqi 33602 2012-02-03 20:44 libva1_1.0.8-3_i386.deb -rw-rw-r-- 1 weiqi weiqi 93674 2012-02-03 20:44 libvorbis0a_1.3.2-1ubuntu1_i386.deb -rw-rw-r-- 1 weiqi weiqi 116528 2012-02-03 20:45 libvorbisenc2_1.3.2-1ubuntu1_i386.deb -rw-rw-r-- 1 weiqi weiqi 236094 2012-02-03 20:45 libvpx0_0.9.6-1_i386.deb
Now I can extract the content of these *.deb files with the following command:
weiqi@gao$ for x in *.deb; do dpkg -x $x /opt/libavcodec52-i386; done
This will populate the /opt/libavcodec52-i386/usr/lib directory with the shared objects needed by the JavaFX 2.1 Beta SDK:
weiqi@gao:/opt/libavcodec52-i386/usr/lib$ ls dri liborc-test-0.4.so.0 libva.so.1 i686 liborc-test-0.4.so.0.11.0 libva.so.1.0.8 libavcodec.so.52 libschroedinger-1.0.so.0 libvorbisenc.so.2 libavcodec.so.52.72.2 libschroedinger-1.0.so.0.10.0 libvorbisenc.so.2.0.8 libavutil.so.50 libspeex.so.1 libvorbis.so.0 libavutil.so.50.15.1 libspeex.so.1.5.0 libvorbis.so.0.4.5 libgsm.so.1 libtheoradec.so.1 libvpx.so.0 libgsm.so.1.0.12 libtheoradec.so.1.1.4 libvpx.so.0.9 libogg.so.0 libtheoraenc.so.1 libvpx.so.0.9.6 libogg.so.0.7.0 libtheoraenc.so.1.1.2 sse2 liborc-0.4.so.0 libtheora.so.0 liborc-0.4.so.0.11.0 libtheora.so.0.3.10
Finally, I need to tell the 32-bit Java process where to find these shared objects. I accomplish this with setting the LD_LIBRARY_PATH environment variable:
weiqi@gao$ export LD_LIBRARY_PATH=/opt/libavcodec52-i386/usr/lib
Now, I can run JavaFX media programs on my 64-bit Ubuntu 11.10 box. One of the results is shown at the beginning of the post.
For those who trust this website, (which you in general shouldn't, unless you know me personally or pseudo-personally) here's a file that you may be interested in getting. :)
