Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I work with JavaFX in Eclipse Juno?

I have installed jdk1.7.0_15.

JavaFX's download page says the following:

JavaFX 2.2.7 contains the latest security fixes and is co-bundled with the latest JDK 7 for Windows, Mac and Linux.
Download Java SE 7 with JavaFX 2.2.7

Like a good noob, I followed the instructions and installed the JDK. Now when I look for jfxrt.jar file that I can import to Eclipse as a user library, I can not find it. There are a few other JavaFX related libraries in JDK's lib folder but I do not understand what to import next.

Most of the tutorials on Google, including the one by Java, are very old.
Please help me get started with JavaFX

like image 617
An SO User Avatar asked Mar 01 '13 02:03

An SO User


2 Answers

I recommend using e(fx)clipse.

e(fx)clipse is a plugin to assist JavaFX development in Eclipse which will fix your classpath issue and provide you with many other useful features as well as step by step documentation and code completion assistance.

like image 169
jewelsea Avatar answered Sep 19 '22 18:09

jewelsea


Great question. I remember having the same problem when I started. Here is a little step by step guide.

1) Make a new JavaFx project (This is actually the same as a Java project, it just comes with a more suitable skeleton)
2) If you're getting errors like 'Can't find javafx.application' add the jfxrt.jar by right clicking on the libraries and select 'Add folder/Jar' You will have to browse to your jdk folder and find jfxrt.jar. Here is where it is located in my jdk:
/jdk1.7.0_15/jre/lib/jfxrt.jar
3) For the third step I suggest checking out this example. This example comes with sample code and I used it to copy and paste till I got a little more comfortable in javafx.

like image 45
SyntaxRules Avatar answered Sep 19 '22 18:09

SyntaxRules