Build JavaFX project without NetBeans


Question

I'm trying to learn JavaFX and maybe create a few "learner" games. I always do my development in Eclipse, rather than NetBeans which the JavaFX team is clearly trying to push.

Can anybody point me in the direction of a how-to for building a JavaFX project in Eclipse, or at least building a JavaFX project without NetBeans? Everything I've found so far either uses NetBeans, or they're running a one-file project in Eclipse (witch won't work for larger projects). Idealy, I'm looking for somebody who's set up a simple Ant script that builds a JavaFX project, since I assume that's the end-game for this situation.

I was able to find where to download the Eclipse JavaFX plugin. It provides syntax highlighting support, plus some "snippets". I can even use it to run simple hello world type JavaFX apps, but I cant seem to get it to automatically build multi-file JavaFX projects. Even if I could, I still can't seem to write a correct ant script to jar up the JavaFX project.

Also, I found this site that talks about what you can do to use a javafxc Ant task created by Sun(?), but I'm not having any luck trying to use what they talk about.

Thanks

Ross

1
2
2/1/2009 2:03:22 AM

Accepted Answer

After I asked this question, an official (I think?) JavaFX plugin for Eclipse was released. Go to the JavaFX for Eclipse page. I installed the plugin and everything automagically worked!

1
10/28/2009 2:11:34 AM

If you create new project in NB there is folder called nbproject. This folder contains build-impl.xml. This file contains this target:

<target if="src.dir" name="-compile-fx">
    <taskdef classname="com.sun.tools.javafx.ant.JavaFxAntTask" classpath="${platform.bootcp}" name="javafxc"/>
    <javafxc bootclasspath="${platform.bootcp}" classpath="${build.classes.dir}:${javac.classpath}" compilerclasspath="${platform.bootcp}" debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${build.classes.dir}" excludes="${excludes}" fork="yes" includeJavaRuntime="false" includeantruntime="false" includes="**/*.fx" source="${javac.source}" sourcepath="" srcdir="${src.dir}" target="${javac.target}">
        <compilerarg line="${javac.compilerargs}"/>
    </javafxc>
</target>

This is good start to create ant for Eclipse. I'm not sure how building works for Eclipse, but there could be limitations. The com.sun.tools.javafx.ant.JavaFxAntTask is located in SDK, not in compiler jar. Good luck!.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon