Question

I'm using Eclipse and have this JavaFX project ready to transform into .jar. Only problem is when i export it and create .jar, it gives me an error on launch. "An Exception occurred". So i did some googling and searching around and found out that JavaFX is not in the core Eclipse and so have to be handled differently. Also i found something which can be done via command line but this also didn't work for me (couldn't locate the path and other disturbing things).

So my question is, is there a simple way to export JavaFX project from Eclipse? I'm pretty confused about this topic and need some help.

Was it helpful?

Solution

If you correctly created the JavaFX project you will have a project structure like this:

enter image description here

Double click the build.fxbuild file, it will open an window with this option in the top-right corner:

enter image description here

Click generate antbuild.xml and run.

If the console shows BUILD SUCCESSFUL (and it should) its done.

The exported jar will be found at MySample\build\dist\

OTHER TIPS

Thanks for Math, who helped me to find a solution to my issue above and issues which were related to this.

I'm answering my own question since there were some things google didn't even show me and maybe someone else later may find this useful.

My first question was answered by Math above.

My second question: how to resolve an issue - unable to find javac compiler, was also an easy one actually:

Window > Preferences > Installed JREs and change the settings from JRE to JDK For this, add JDK from Program Files/Java/java_vesion

My third question was about namespace issue: I was given an error:

BUILD FAILED C:\Users\Kevin\Documents\UT\2013\kevad\OOP\Baila_2.0\build\build.xml:87: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:resources Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any / declarations have taken place. No types or tasks have been defined in this namespace

It was resolved by changing Run->External Tools_>External Tools Configurations and selecting JRE Tab. I had to change the Execution environment from 1.7 to CDC-1.0/Foundation-1.0 (jdk1.7.0_25) (and CDC-1.1 also works).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top