Recent Changes - Search:

Working with JavaFX Script[-'^TM^'-] files

<< Running a file | TOC | JavaFX Demos >>

Also see Creating Rich Internet Applications with JavaFX at

Working with JavaFX files in JMaker

This is done in 4 steps:

  1. Download and copy the JavaFX jar files (you only need to do this one time)
  2. Set the JMaker java options to run JavaFX files - your .java files will probably still run
  3. Copy, paste and save the HelloWorld.fx program in a JMaker Edit Window
  4. Run the HelloWorld.fx program

JavaFX API documentation at

1) Download and copy the JavaFX jar files from the JavaFX website into your JDK installation. There are 3 of them:

(Note: Since posting these steps Sun appears to have discontinued the downloads and instead is requiring you to use their IDE)
(If you have more information please post to the JavaFX forum)

  1. Filters.jar
  2. javafxrt.jar
  3. swing-layout.jar

Note: In the following examples the .jar files are placed in the JDK6/jre/lib folder

2) Setup your java options in JMaker to run JavaFX files
Here is a sample HelloWorld.fx program downloaded from the JavaFX website.

import javafx.ui.*;

class HelloWorldModel {

    attribute saying: String;


var model = HelloWorldModel {

    saying: "Hello World"


var win = Frame {

    title: bind "{model.saying} JavaFX"
    width: 200
    height: 50
    content: TextField {
	value: bind model.saying
    visible: true


3) Copy and paste it into a JMaker Edit Window.
Save it as HelloWorld.fx in the C:\JDK6\bin folder
4) Run it by pressing the "Run" button in the Edit Window
Your HelloWorld.fx program running should look something like this:


To work with JavaFX files and to run the HelloWorld.fx example:
  1. Download and copy the JavaFX jar files into your JDK installation. In this example they are in the C:/JDK6/jre/lib folder
  2. Set up your JMaker java options as shown above - be sure the lib path in the "-cp" java option matches your lib path
  3. Copy and paste the HelloWorld.fx example above into a JMaker Edit Window
  4. Save it as HelloWorld.fx in your JDK\bin folder
  5. Press the "run" button

The java command to run HelloWorld.fx will look like this:
C:\JDK6\bin\java -cp .;C:\JDK6\jre\lib\javafxrt.jar;C:\JDK6\jre\lib\Filters.jar;C:\JDK6\jre\lib\swing-layout.jar HelloWorld

In this example:
The java.exe file is inC:\JDK6\bin
The JavaFX jar files are inC:\JDK6\jre\lib
The classpath is.;C:\JDK6\jre\lib\javafxrt.jar;C:\JDK6\jre\lib\Filters.jar;C:\JDK6\jre\lib\swing-layout.jar
The 'other' options
The .fx filename isHelloWorld
The HelloWorld.fx file is saved inC:\JDK6\bin
The working directory (where your prompt would be = PWDC:\JDK6\bin
Packaged is not selectedThe HelloWorld.fx example is not packaged
The JMaker run process window output will be something like this:

(The lines are numbered for clarity)

  1. C:\JDK6\bin\java -cp .;C:\JDK6\jre\lib\javafxrt.jar;C:\JDK6\jre\lib\Filters.jar;C:\JDK6\jre\lib\swing-layout.jar HelloWorld
  2. compile thread: Thread[AWT-EventQueue-0,6,main]
  3. compile 1.328
  4. init: 0.672
  5. C:\JDK6\bin\java -cp .;C:\JDK6\jre\lib\javafxrt.jar;C:\JDK6\jre\lib\Filters.jar;C:\JDK6\jre\lib\swing-layout.jar HelloWorld
  6. is done.

Note:You can double-click on error messages in the run process window to highlight them in the Edit Window source.

You can find more cool JavaFX examples at:
Don't forget the import javafx.ui.*; at the top of the file!

How to put your .fx source files in a different folder

You can append your source folder path(s) to the -cp option:

Here is an example that lets you put your source.fx files in the C:\JDK6\source folder

  • -cp .;C:\JDK6\jre\lib\javafxrt.jar;C:\JDK6\jre\lib\Filters.jar;C:\JDK6\jre\lib\swing-layout.jar;C:\JDK6\source

Notice the ";C:\JDK6\source" appended to the end of the -cp option

You can also change this by changing the JMaker working directory.

At the prompt it might look like this:

  • cd \C:\JDK6\source
  • \C:\JDK6\bin\java jmaker1.JMaker1

See JavaFX Demos for ideas about how to work with the JavaFX demo files in JMaker.

Edit - History - Print - Recent Changes - Search
Page last modified on June 06, 2008, at 02:35 PM