JavaFX的自动完成功能在Eclipse Luna中不起作用 [英] Auto-completion for JavaFX not working in eclipse luna

查看:65
本文介绍了JavaFX的自动完成功能在Eclipse Luna中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试JavaFX时,我目前在自动完成方面遇到问题.我有一个标准Java项目,将Java 8设置为源和目标:

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>

这已被正确识别,我可以对Stream API使用自动补全功能,等等.

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

一些线程,例如如何在Eclipse Swing项目中使用JavaFX ,表明jfxrt是使用JavaFX所必需的. Eclipse在/usr/lib/jvm/java-8-oracle/下使用了正确的JVM,并且在/usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt中找到了正确的jfxrt.jar.罐.如果我手动(在Package Explorer中)打开JRE系统库-> jfxrt.jar-> javafx.embed.swing,我会看到JFXPanel应该放置在那里.

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.

尽管如此,当我在输入JFXPanel后点击Strg + Space时,它仅告诉我使用该名称创建一个类.即使我写import javafx.embed.swing,也只建议我写import javafx.embed.swing.*而不是此程序包中的任何类.

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.

这种行为对我来说似乎很尴尬.谁能告诉我,为什么Eclipse无法完成此操作,或者我可以做些什么来防止此问题发生?

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?

推荐答案

转到项目属性-> Java构建路径-> []-> JRE系统库.检查您是否使用的是jdk,而不是jre.如果使用jre切换到jdk,问题将得到解决

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

这篇关于JavaFX的自动完成功能在Eclipse Luna中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆