<< JSR 277: On Hold | Home | St. Louis λ-Lounge >>

Using JavaFX 1.0 On Linux

[Update (Wed Jun 3 07:45:43 PDT 2009)]: As of June 2, 2009, you can download the Linux and Solaris version of JavaFX 1.2 SDK directly from http://javafx.com. The Linux and Solaris support is preview only.[/]

This is a quick update to my Watch JavaFX SDK Run---On Linux post from 121 days ago.

With the preview release, we got an easy pass because zip file versions of the SDK was available from the download site. For the now online JavaFX 1.0, only the Windows installer and the Mac OS X disk image (*.dmg) versions are available.

Fortunately, Linux can deal with Mac dmg files quite easily. Here's what I tried on my Ubuntu 8.10 amd64 box:

  1. Download The Mac OS X version of JavaFX SDK 1.0 from JavaFX Downloads for Mac and Windows page
  2. Run bunzip2 to decompress the downloaded javafx_sdk-1_0-macosx-universal.dmg
  3. Mount the result at a directory. The directory will contain many levels of subdirectries and files
  4. Unarchive on of the files with cpio to get a javafx-sdk1.0 directory

Here's a transcript of my terminal session:

[weiqi@gao:~] $ file javafx_sdk-1_0-macosx-universal.dmg 
javafx_sdk-1_0-macosx-universal.dmg: bzip2 compressed data, block size = 100k
[weiqi@gao:~] $ bunzip2 javafx_sdk-1_0-macosx-universal.dmg
bunzip2: Can't guess original name for javafx_sdk-1_0-macosx-universal.dmg -- using javafx_sdk-1_0-macosx-universal.dmg.out

bunzip2: javafx_sdk-1_0-macosx-universal.dmg: trailing garbage after EOF ignored
[weiqi@gao:~] $ mkdir mount-point
[weiqi@gao:~] $ sudo mount -o loop -t hfsplus javafx_sdk-1_0-macosx-universal.dmg.out mount-point
[sudo] password for weiqi: 
[weiqi@gao:~] $ mkdir javafx-sdk1.0
[weiqi@gao:~] $ cd javafx-sdk1.0/
[weiqi@gao:~/javafx-sdk1.0] $ gunzip -c ../mount-point/javafx_sdk-1_0.mpkg/Contents/Packages/javafxsdk.pkg/Contents/Archive.pax.gz | cpio -i
65687 blocks
[weiqi@gao:~/javafx-sdk1.0] $ ls
bin             docs  LICENSE.txt  README.html  servicetag  THIRDPARTYLICENSEREADME.txt
COPYRIGHT.html  lib   profiles     samples      src.zip     timestamp

A little involved, but we got our javafx-sdk1.0 directory. Copy it to the appropriate place like /opt or wherever you install software packages, add the javafx-sdk1.0/bin directory to your $PATH, and you are in business.

As usual, all the pure Java stuff should work.

I'll let you know what I can do when I play a little bit more with it.

Tags :


Re: Using JavaFX 1.0 On Linux

any idea how to get netbeans to work with this? Can't figure out how to get netbeans javafx component I got everything else working thanks for the info.

Re: Using JavaFX 1.0 On Linux

Great instructions. Thank you.

Re: Using JavaFX 1.0 On Linux

Once again, thank you very much.

Re: Using JavaFX 1.0 On Linux

The examples contained within the JavaFX 1.0 SDK all have Ant build scripts, so as long as you set JAVAFX_HOME in /etc/profile (or wherever required on your system) then it is simply a standard Ant build, completely independent of the IDE. Additionally, I have invoked buld.xml from within IntelliJ without issue.

Re: Using JavaFX 1.0 On Linux

I don't understand - if JavaFX is pure Java, and installing it on Linux is this easy, why didn't Sun just make a Linux package (just a .tar.gz of what you did)? I really wonder what Sun is thinking...

Re: Using JavaFX 1.0 On Linux

Unfortunately, JavaFX is not pure Java. The really interesting parts, visual effects and video playback, are native code. And its those parts that are not ready.

You can still do a lot with the pure Java part. The whole language, including animation, is there. The Swing and Java2D based nodes are there.

Re: Using JavaFX 1.0 On Linux

I'm really impressed, not for JavaFX on Linux (we can waiotr a little bit more ;-), I'm really impressed for "mounting and using and enjoying" a Apple's DMG resource. I don't know how old it's this trick but, for me, it's really nice!

Re: Using JavaFX 1.0 On Linux

this is really helpful...thank you Weigi Gao from another interested linux user. raxpl

Re: Using JavaFX 1.0 On Linux

Hi Gao, I think you are right, some native libraries for visual effect cannot be used on linux because it is for Mac OS. For now, this trick can be applied for some simple JavaFX programming. Nice post any way. Thanks. Henry

Re: Using JavaFX 1.0 On Linux

Deployment of SimpleVideoPlayer in firefox web browser on linux works (after change a line in Main.fx for a valid .flv file)!!!! Java downloads the javafx runtime, native libraries(gstreamer,jogl) and third party jars !!!

Re: Using JavaFX 1.0 On Linux

Thanks for the info. Got it to work on my Ubuntu as well. :)

Re: Using JavaFX 1.0 On Linux

Hello, Im sorry I know this is a retarded question but I created the folder with all the Java.fx stuff and I dont know what this means "Copy it(folder) to the appropriate place like /opt or wherever you install software packages, add the javafx-sdk1.0/bin directory to your $PATH, and you are in business." I can place it on the /opt folder or any no problem but i want to make sure I link the bin properly and that is not clear to me. THANKS IN ADVANCE.

Re: Using JavaFX 1.0 On Linux

If you have copied the javafx-sdk1.0 folder to /opt, then you need to add something like the following to your .bashrc file and relogin:

export PATH=$PATH:/opt/javafx-sdk1.0/bin

That will allow you to run javafxc, javafx, javafxdoc, javafxpackager from the command line.

Re: Using JavaFX 1.0 On Linux

I'm stuck at step one:
file netbeans-6.5-javafx-macosx.dmg
netbeans-6.5-javafx-macosx.dmg: VAX COFF executable not stripped
My bzip2 is "Version 1.0.3, 15-Feb-2005", I'm on CentOS:
uname -sro
Linux 2.6.18-92.1.22.el5xen GNU/Linux

Am I hosed? My system is up2date and I'm not finding another bzip anywhere :( If this were to work, I would echo Daad's comment - nice trick!

Re: Using JavaFX 1.0 On Linux

You downloaded the wrong thing. You downloaded the "NetBeans IDE 6.5 for JavaFX 1.0". Try downloading the Mac version of the "JavaFX 1.0 SDK" from the download page.

Re: Using JavaFX 1.0 On Linux

I installed everything and added into the $PATH variable, but when I tried to download and install the plugin from NetBeans, it said that the sdk is not found. Did I do anything wrong in the process?

Re: Using JavaFX 1.0 On Linux

Try this.

Re: Using JavaFX 1.0 On Linux

Great instructions! I took the freedon to use your instructions to reduce the steps necessary to install it and provide everything in a single linux friendly package. It can be found at: http://www.leo-sa.com/?p=59 With that there is no need to uncompress mac files or carefully select netbeans' plugins. Comments and suggestions are welcome!

Re: Using JavaFX 1.0 On Linux

I tried with javafx sdk 1.1 but the mount failed

  sudo mount -o loop -t hfsplus javafx_sdk-1_1-macosx-universal.dmg.out mount-point
[sudo] password for mao: 
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

help please! tnx

Re: Using JavaFX 1.0 On Linux

I have the same error on Ubunte 8.10

Re: Using JavaFX 1.1 On Linux

Great Site. Thanks

I've installed JavaFX SDK 1.1 on Linux using a .nbm file from NetBean.org
1-http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/patch2/javafx2/
2-Download "org-netbeans-modules-javafx-sdk-mac.nbm"
3-$ unzip org-netbeans-modules-javafx-sdk-mac.nbm
4-Among the decompressed directories a directory called "netbeans" inside this a directory called "javafx-sdk". This directory is the SDK
5-$ chmod u+x javafx-sdk/bin/*
6-Add javafx-sdk/bin to your PATH
7-Enjoy :)
8-http://java-javafx-iipt.blogspot.com/2009/02/installer-javafx-11-sdk-sur-linux.html

Re: Using JavaFX 1.1 On Linux

That seems to have worked, thanks!

Re: Using JavaFX 1.0 On Linux

Using Ubuntu 8.04, same mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so

Re: Using JavaFX 1.0 On Linux

I'm also getting the "wrong fs type, bad option, bad superblock..." error when attempting to mount the .dmg file when using JavaFX SDK 1.1.1 on Intrepid. I'll try the JavaFX 1.0 version and see if that works. Thanks for the info anyway.

Re: Using JavaFX 1.0 On Linux

Very annoying to see so many people all over the internet have this problem where 1.1 just will NOT mount. The only feedback is from people that state the same thing over and over: type this type that. And nothing works. Very very frustrating.

HA! GOT IT! SOLVED! FINALLY!

mount -o loop,offset=$((1024*17)) -t hfsplus javafx_sdk-1_1-macosx-universal.dmg.out mount-point The solution is to add the offset=$((1024*17)) part ! The darn thing is in some strange Mac partition. I started with doing fdisk -l javafx_sdk-1_1-macosx-universal.dmg.out which revealed cylinder 1 to 17. A partition starts at a given offset, so I started to play with offsets in the mount. I couldn't find the offset so I wrote a script that just tried every offset. Then I saw it mount successfully at offset 17408, which is 1024 * 17.

Mounting 1.1 with an offset

Brilliant observation from Mike P above. The GUID partition table in javafx_sdk-1_1 says that the HFS+ partition should start at sector 0x28 (offset 0x5000). That is the value of the QWORD at offset 0x420. Strange, but in reality the partition starts at sector 0x22 (offset 0x4400 = 17408), i.e. 6 sectors below. Probably I am missing something in the GUID specification.

Add a comment Send a TrackBack