• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

The import javafx cannot be resolved

 
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to develop any application using JavaFX. I am using Eclipse Indigo and JavaFX 2.0 SDK. I have installed the JavaFX plugin to eclipse and followed these steps to create a project: Create project using JavaFX.

But when I try this code:


I get the following multiple errors of this kind:
What do I do?
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error straight forwardly implies javafx is not present in the project's class path. You should rather try the HelloWorld application provided in the tutorial link you posted.

And follow the steps from scratch to the HelloWorld program.
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Jai wrote:The error straight forwardly implies javafx is not present in the project's class path. You should rather try the HelloWorld application provided in the tutorial link you posted.

And follow the steps from scratch to the HelloWorld program.


I have added JavaFX to the project's class path. I tried the HelloWorld program given there too. But the errors persist.

I am going through this thread. There seems to be no satisfactory conclusion there too.
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could it be problem with the JavaFX plug-in?
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Class path should point to a location where your class files (or jar files) are present. Is there a lib folder parallel to the bin in the Java FX installation? Does that have jar files?
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Jai wrote:Class path should point to a location where your class files (or jar files) are present. Is there a lib folder parallel to the bin in the Java FX installation? Does that have jar files?



There is no lib folder.
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I moved this thread to JavaFX forum.

I dont think Eclipse has a plugin for JavaFX 2.0 yet, but this post would help you to configure your eclipse.

And the link you have mentioned is for older verion of JavaFX.

You can download Netbeans 7.1 beta from here which comes with JavaFX 2 support.

Note that JavaFX 2.0 is not compatible with older versions. So when you are searching use the version number.
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Sanaulla wrote:I moved this thread to JavaFX forum.

I dont think Eclipse has a plugin for JavaFX 2.0 yet, but this post would help you to configure your eclipse.

And the link you have mentioned is for older verion of JavaFX.

You can download Netbeans 7.1 beta from here which comes with JavaFX 2 support.

Note that JavaFX 2.0 is not compatible with older versions. So when you are searching use the version number.



Since my entire project is in Eclipse, I would like to stick on to Eclipse. Which (older)version of JavaFX do I have to install? Could you please give me the link?
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you visit the link I provided in my reply for configuring Eclipse?
You should be using JavaFX 2.0 and above version. Older versions are not supported anymore.
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Sanaulla wrote:Did you visit the link I provided in my reply for configuring Eclipse?
You should be using JavaFX 2.0 and above version. Older versions are not supported anymore.


Thank you. I don't get this error now-

But there is this error in the line 11 of the code I posted in the first post of this thread-
What do I do?
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shikha Upadhyaya wrote:
But there is this error in the line 11 of the code I posted in the first post of this thread-
What do I do?


I fixed this error.

But now I have a new exception in my program.

How do I set this right?
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you installed the JavaFX SDK? I think its missing the runtime related files. Not sure though. Try installing runtime again.
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Sanaulla wrote:Have you installed the JavaFX SDK?


I have installed JavaFX 2.0 SDK which is now located in C:/Program Files/Oracle. I have also set the class path to C:/Program Files/Oracle/JavaFX2.0 SDK.

Mohamed Sanaulla wrote:I think its missing the runtime related files. Not sure though. Try installing runtime again.


I have installed and uninstalled and again installed JavaFX 2.0 SDK twice. No change in the exception list. Is there something called installing the runtime separately? If yes, how do I do it?

But I would like to stress upon one observation here. When I click on File > New > JavaFX project, a window "New JavaFX project" opens. In that window I can see an error message- A valid JavaFX SDK was not detected.

 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have JavaFX SDK then you have the runtime as well.

Shikha Upadhyaya wrote:

But I would like to stress upon one observation here. When I click on File > New > JavaFX project, a window "New JavaFX project" opens. In that window I can see an error message- A valid JavaFX SDK was not detected.



I dont think Eclipse supports New JavaFX project as I am not sure if Eclipse has a plugin to support JavaFX 2.0. You must be creating a usual Java project and then follow the JavaFX sample code - Am just thinking loud here, not tried it.
But on Netbeans 7.1 beta you can create a new JavaFX project and proceed with the development - I have tried this though.
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Sanaulla wrote:If you have JavaFX SDK then you have the runtime as well.

I dont think Eclipse supports New JavaFX project as I am not sure if Eclipse has a plugin to support JavaFX 2.0. You must be creating a usual Java project and then follow the JavaFX sample code - Am just thinking loud here, not tried it.
But on Netbeans 7.1 beta you can create a new JavaFX project and proceed with the development - I have tried this though.


Oh Shifting the entire project to Netbeans would be tedious. There's nothing at all which can be done. Any other breakthrough using Eclipse only as the IDE?
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try creating a usual Java project and then add the javafxrt jar as mentioned here and then try to create the sample application. Also uninstall the javaFX plugin which you have installed for Eclipse.
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Sanaulla wrote:You can try creating a usual Java project and then add the javafxrt jar as mentioned here and then try to create the sample application. Also uninstall the javaFX plugin which you have installed for Eclipse.


I just tried this piece of code. The same set of exceptions continue to show up.
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used Eclipse Helios to run JavaFX application and it works. I didnt install any JavaFX plugin for Eclipse.
Also I created a simple Java project and then added the following:


I also added the jfxrt.jar to the External jars for the project.
I was able to run the application.
Also please use the tutorials from this page as they are relevant for the latest release of JavaFX
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Sanaulla wrote:I used Eclipse Helios to run JavaFX application and it works. I didnt install any JavaFX plugin for Eclipse.
Also I created a simple Java project and then added the following:


I also added the jfxrt.jar to the External jars for the project.
I was able to run the application.
Also please use the tutorials from this page as they are relevant for the latest release of JavaFX


Oh then *Eclipse Indigo* is the problem!!
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Oh then *Eclipse Indigo* is the problem!!


I dont think it should be the problem.
What is the version of JRE you are using when you are trying to run the application? What matters here would be the JavaFX library and the runtime and the compatible JRE version.
 
Shikha Upadhyaya
Ranch Hand
Posts: 70
Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Sanaulla wrote:I dont think it should be the problem.
What is the version of JRE you are using when you are trying to run the application? What matters here would be the JavaFX library and the runtime and the compatible JRE version.


When I created the project I had checked JavaSE 1.6 as the execution environment JRE in the New Java Project window.
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shikha Upadhyaya wrote:

Mohamed Sanaulla wrote:I dont think it should be the problem.
What is the version of JRE you are using when you are trying to run the application? What matters here would be the JavaFX library and the runtime and the compatible JRE version.


When I created the project I had checked JavaSE 1.6 as the execution environment JRE in the New Java Project window.



I think JavaFX 2 required Java SE 7, so you would have to change in the preferences to use Java 7
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic