对于示例"mavenproject",包javafx不存在. netbeans 7.4 [英] package javafx does not exist for sample "mavenproject" netbeans 7.4
问题描述
我试图运行通过执行"File :: new project"并选择"maven"然后选择"JavaFX Application"创建的"mavenproject1"文件.
I am trying to run the "mavenproject1" file created by doing a "File::new project" and selecting "maven" then "JavaFX Application".
我正在使用最新和最好的.我有单独安装的Java JDK 1.7.0_45,该Java JDK配置为构建项目.我有内置了MAVEN 3的Netbeans 7.4(内部版本201310111528).JavaFX与JDK 1.7.0_45捆绑在一起.
I am using the latest and greatest. I have Java JDK 1.7.0_45 which I installed separately that is configured to build the project. I have Netbeans 7.4 (Build 201310111528) with MAVEN 3 built in. JavaFX is bundled with the JDK 1.7.0_45.
我可以使项目执行,但是我的源文件得到一个错误,指示JavaFX软件包不存在.我在pom.xlm文件中添加了以下内容,即使NB编辑器找不到JavaFX程序包,该文件也允许Maven构建和执行源文件:
I can make the project execute, but my source files get an error indicating that the JavaFX package does not exist. I added the following to my pom.xlm file which allows Maven to build and execute the source files even though the NB editor cannot find the JavaFX packages:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>2.0</version>
<scope>system</scope>
<systemPath>${java.home}\lib\jfxrt.jar</systemPath>
</dependency>
如何让NB编辑器识别JavaFX软件包?
How can I get the NB editor to recognize the JavaFX packages?
推荐答案
If you can, I advise using Java 8 as:
- JavaFX是Java 8中默认的Java类路径,而不是Java 7中.
- 由于JavaFX位于默认的Java 8类路径上,因此您在maven项目中不需要依赖jfxrt.jar的系统路径.
- 由于JavaFX在默认的Java 8类路径上,因此NetBeans 7.4无需额外配置即可识别JavaFX软件包.
您可能还需要考虑使用 javafx-maven-plugin .
You may also want to consider using the javafx-maven-plugin.
这篇关于对于示例"mavenproject",包javafx不存在. netbeans 7.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!