Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using JavaFX (JDK 1.8.0_05) in Eclipse Luna does not work

I have a fresh install of Java 8 (JDK 1.8.0_05 on Windows 7 32 bit) and Eclipse Luna. When I try to build a simple JavaFX program Eclipse shows the following message in the editor:

Access restriction: The type 'Application' is not API('C:\Program Files\Java\jre8\lib\ext\jfxrt.jar')

If I use the javac on the command line to compile the program every thing works fine.

Any hints how to solve this Problem?

like image 346
Klaus Rohe Avatar asked Jun 28 '14 14:06

Klaus Rohe


People also ask

Why is my JavaFX not working in Eclipse?

The project doesn't support the JavaFX syntax. We need to export the JavaFX jar files to the project in order to run the JavaFX application. Just Right click on the project and select properties from the options. Go to Java Build Path → Libraries.

Does Eclipse have Java FX?

In this JavaFX Tutorial, JavaFX has been successfully installed on Eclipse.


2 Answers

Finally , adding Access rules on ".classpath" file in eclipse project solved this issue for me.

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<accessrules>
            <accessrule kind="accessible" pattern="javafx/**"/>
        </accessrules>
    </classpathentry>   
like image 141
jayalalk Avatar answered Nov 15 '22 23:11

jayalalk


This solved the problem for me:

  • Opened the properties of the JRE of the Eclipse project using the context menu on the JRE
  • Instead of "Execution environment" I choose "Alternate JRE" and then "jdk1.8.0_5" - eventually you have to configure that "Alternate JRE" before
like image 37
marc Avatar answered Nov 15 '22 21:11

marc