[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.)
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:
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:
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:
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. :)