5

While trying out JavaFX, I'm currently having problems with auto-completion. I have a standard-maven project with Java 8 set as source and target:

         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>

This is correctly recognized, I can use auto-completion for Stream API and so on.

Some threads, e.g. How to Use JavaFX in Eclipse Swing Project, show that jfxrt is necessary for using JavaFX. Eclipse uses the correct JVM under /usr/lib/jvm/java-8-oracle/ and it does find the correct jfxrt.jar in /usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar. If I manually open (in the Package Explorer) JRE System Library -> jfxrt.jar -> javafx.embed.swing I see JFXPanel laying there as it should.

Nevertheless, when I hit Strg + Space after the input of JFXPanel it only tells me to create a class with this name. Even if I write import javafx.embed.swing it only suggests me to write import javafx.embed.swing.* instead of any class in this package.

This behaviour seems very awkward to me. Can anyone tell me, why eclipse isn't able to complete this or what I could do to prevent this problem from happening?

Community
  • 1
  • 1
David Georg Reichelt
  • 963
  • 1
  • 15
  • 36
  • 1
    For some reason the JavaFX API in Eclipse is marked as "Forbidden" through the `**/*` access rule (go Build Path for a project and select Libraries -> JRE/or JDK). Try [efxclipse](http://www.eclipse.org/efxclipse/index.html). – Nikos Paraskevopoulos Dec 09 '14 at 09:23
  • Thanks for the hint, but in Configure -> Build Path -> Access rules there is nothing defined (it says 'No rules defined' and is empty). Is there any way to mark the JavaFX API as not forbidded without using efxclipse? – David Georg Reichelt Dec 09 '14 at 10:33
  • I would be interested in that too :) – Nikos Paraskevopoulos Dec 09 '14 at 11:34
  • Edit it? But really this NOT eclipse fault anything on the ext-classpath is NOT public API and Eclipse hides it. Please note thate efxclipse will make your live so much easier e.g. with advanced CSS-Tooling, ... but anyways editing the rules should give you access to JavaFX – tomsontom Dec 10 '14 at 11:51

1 Answers1

1

Go to project properties -> Java Build Path -> [] -> JRE System Library. Check whether you are using a jdk and not a jre. If using a jre switch to a jdk and the issue will be resolved