Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-completion for JavaFX not working in eclipse luna

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?

like image 854
David Georg Reichelt Avatar asked Nov 10 '22 22:11

David Georg Reichelt


1 Answers

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

like image 159
Kandeepa Sundaram Avatar answered Nov 14 '22 23:11

Kandeepa Sundaram