use JavaFX from Jython

I love Python, even on JVM! So, I decided to use JavaFX from Jython.

This article is a 20th day of JavaFX Advent Calendar 2012

I started translating Java code on this article into Jython.

Setting up Environment

We need JavaFX SDK and Jython which can use it. A following sequence is actual processes I went through.

To obtain JavaFX developing environment, I installed JavaFX for Java SE 7.

Following this instruction, I made Java 7 as a default JDK.

$ sudo mv /System/Library/Java/JavaVirtualMachines/1.6.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk.bak
$ sudo ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
$ java -version
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)

Next I compiled Jython with Java 7.

$ hg clone https://bitbucket.org/jython/jython
$ cd jython
$ ant
$ ls dist/bin/jython

The result jython executable exists at dist/bin/jython. When I compiled, the Mercurial changeset ID is 6898:2ccd73a00a86 and Jython version is 2.7.0a2+.

Now, all had been set up.

Hello, World!

Since ...

Licenses