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
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.
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.
Related
I am trying to switch from eclipse to netbeans The first thing I am trying do is download the correct version of netbeans. However, when I follow the instrunctions to import a maven project it asks me to choose that from the left hand panel (After a clicking on a new project)
But the only things listed are HTML5 and Javascript projects.
Are there special plugins or am I downloading the wrong version of netbeans? I got here: https://netbeans.org/downloads/index.html and download the java2EE version, but I have not luck. Any ideas?
Since NetBeans is currently in the process of being handed over to Apache by Oracle there are actually four places where you can download different flavors of NetBeans at the moment:
The Oracle location you used is for NetBeans 8.2, the latest stable release. It supports the use of Java 8, but not Java 9 or Java 10.
There is also another Oracle location accessible from the link in your OP if you click the Development link in the top right corner of the page. That version, sometimes known as the "nightly build", also supports Java 9, but not Java 10, and includes some bug fixes not in 8.2
A third option is to download the initial beta Release of NetBeans 9 which supports all Java releases including Java 10, as well as EE 8 from here. See the NetBeans 9 web site for more details. Maven version 3.3.9 is bundled with NetBeans, but you can also use your own external version if you prefer.
The fourth option, and the one I recommend if you are just getting started on NetBeans, is to use the latest release of NetBeans 9 with bug fixes. You can download the latest zip file (which runs on Linux/MacOS/Windows) from here.
The formal release of Netbeans 9 will be sometime next month.
Something is clearly wrong with your current setup if you do not see any options for creating a Java project in the New Project window. Is it possible that you downloaded the HTML5/JavaScript version of NetBeans rather than the Java EE version? They are right next to each other on the download page.
If that is the problem it is possible to upgrade by installing plugins, but it would be much simpler to download again using any of the options described above. You can safely run multiple versions of NetBeans concurrently if you want to try them out, though the GUI is pretty much the same in all cases.
If you only need Java 8/EE 7 then you can stick with option #1, but I you want to use Java 9 and/or Java10 and/or EE 8 then use option #4.
Download the "All" version, then install maven separately.
Open netbeans and navigate to Tools > Options > Java > Maven and change the 'Maven Home' path to the directory where maven is installed.
I have just installed the JDK1.8.0 32 bit version on my computer and that all seemed to work nicely. I then followed the instructions on this stackoverflow page to add tools.jar to the Eclipse (although, to be honest, I'm not quite sure what that means?). I'm still getting the error: "Requires JDK 5.0 or later. Please download it from http://java.sun.com/j2se/1.5/".
Could someone please help me understand what the problem is? Also, please let me know if I haven't given enough information, this is my first attempt at using Eclipse and I don't know if you need any other info.
Thanks
Mike
The Oracle JDK installation does not install Java in the location where Eclipse by default looks for it.
I would suggest that you go to http://java.com/en/download/installed.jsp and follow instructions to get a default Java installation on your system.
Eclipse will then use that to run itself. You can then tell Eclipse about your Java 8 JDK in Preferences -> Java -> Installed JRE's and that it is to be used by default by the projects you write.
Note that there is not full support for the new Java 8 facilities in Eclipse yet. That will most likely come in Eclipse 4.4 scheduled for June (http://wiki.eclipse.org/Simultaneous_Release)
When you make a new project, make sure it's using the JRE you want. You may have to change it from default to "use project specific JRE", and then select the 1.8.
I am a relative newbie to programming, I have a bit of experience building Swing apps and I now want to try my hand at learning JavaFX. I am using Eclipse Kepler as my IDE.
I understood from the JavaFX website that JavaFX is included in the JDK7 - Quote: "The first step in getting started with JavaFX is to download and install the Java SE 7 JDK, which includes the JavaFX runtime libraries and utilities. See the JDK 7 and JRE 7 Installation Guide for instructions."
However, when I try to import the Oracle JavaFX HelloWorld example (http://docs.oracle.com/javafx/2/get_started/hello_world.htm) into an Eclipse project I get errors on the JavaFx package imports. The only suggestions I get are to create new classes etc or 'search repositories for javafx.application'
Does this mean that Eclipse does not support JavaFX out of the box?
So my question to the community is two-fold:
1. please explain how to use JavaFX working in Eclipse. I checked out other answers which seem to indicate that I should install f(x)eclipse. But...
before you tell me that this is a duplicate question, my second question is please also help me understand how, when Oracle say that JavaFX is included in JDK7, it is not possible to import those packages regardless of the IDE (just like it is possible with Swing).
Thanks
It is part of the JDK but not on a classpath hence extra work needed with Java7 - on Java8 it is on the ext-classpath - so the correct answer is - something being part of JDK does not mean it is on the classpath by default.
So tools like Eclipse need to take extra care of this.
Since JDK 7 update 51 JavaFX is a part of JDK: release notes
I'm an experienced (Java, Eclipse & Maven) developer, and have used a couple of frameworks thus far. Every time I'm trying to start with something new, it seems like there are about a zillion configuration possible for downloading and installing it.
I've looked here for instructions, and all the near pages, but they seem out dated, the Eclipse plugin path is invalid, and when I install the latest version I've found no the site (2.0.2), it says that I have a newer version installed.
Also, the Maven setup in most posts I've read seems obscure.
I'm using:
Windows 7
Eclipse x64 Indigo
JDK x64 1.6.0.24
Maven 3.0.3
And I don't recall installing the JavaFX.
What an I missing? Where can I read about the setup in order to start working with this framework?
JavaFX gets installed if you install the latest JDK 7 from Oracle (co-bundled).
You can find the Eclipse plugin here:
http://efxclipse.org/
If your're interested in Maven builds: I've recently released an initial version of Drombler FX, a modular RCP for JavaFX based on OSGi and Maven (POM-first):
http://puces-blog.blogspot.ch/2012/12/drombler-fx-building-modular-javafx.html
http://wiki.drombler.org/GettingStarted
I did tried efxclipse but it was not enough for me. I have also tried to give the path of javafx jar file to efxclipse
Window->Prefrences->javafx->"The path to javafx jar which is
jfxrt.jar"
. But nothing worked for me I don't know what was going wrong.
Then I just add the jfxrt.jar file to my Library and everything worked fine :-
1. Right click your JRE System Library
2. Build Path
3. Configure Build Path
4. Add External Jars
5. "The path to jfxrt.jar"
You can download jfxrt.jar file from this link.
Or
If you have already downloaded the latest oracle JAVA JDK you will find in this path
Extracted_oracle_jdk_folder/jre/lib/ext/jfxrt.jar
That's it everything should work fine.
Try e(fx)clipse at http://efxclipse.org/. I'm a netbeans developer, but heard a lot of good stuff about that plugin from my eclipse using friends.
I've just upgraded my Netbeans to 7.1.2 as I thought I'd have a bash at some JavaFX development, however I'm not having a lot of fun.
First I downloaded the newest Netbeans and installed it, all fine.
Then Netbeans told me I didn't have JavaFX support, so I downloaded the jdk-7 from Oracle and the netbeans JavaFX plugin, and now I can create JavaFX applications.
However, whenever I try to compile a JavaFX app, I get the following error:
Error: failed to msvcr100.dll java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\Java\JavaFX 2.1 Runtime\bin\msvcr100.dll: Can't find dependent libraries
Exception in thread "main" java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\Java\JavaFX 2.1 Runtime\bin\glass.dll: Can't find dependent libraries
Now both of these mentioned files exist, and they are in the locations mentioned, I'm assuming the problem is something to do with my classpath and/or the Sun/Oracle Netbeans previous installation I had.
I can't really be bothered to uninstall/reinstall all of my Java stuff, so I was wondering if anyone had any suggestions on how to fix this?
Some articles I've read have mentioned copying certain DLLs directly into the project workspace, but that doesn't sound right to me.
Any advice or suggestions would be greatly appreciated.
Thanks!!
Right-click your Netbeans project and click to "Properties". Navigate to "Libraries" and determine which "Java Platform" is used by the current project (which is selected one in the dropdown list). Click the "Manage Platforms..." nearby and select the determined Java platform. Go to JavaFX tab then check if the JavaFX is enabled and points to the correct SDK and Runtime paths in your file system.
Also consider restart the Netbeans or even Windows.
If you are using MacOS, even after install Java 7 the default SDK is still Java 6, despite the FX can be activated. Simply add JDK7 and it should fix the problem.