Tom D
Tom D

Reputation: 33

package javafx does not exist for sample "mavenproject" netbeans 7.4

I am trying to run the "mavenproject1" file created by doing a "File::new project" and selecting "maven" then "JavaFX Application".

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.

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>

How can I get the NB editor to recognize the JavaFX packages?

Upvotes: 3

Views: 15451

Answers (1)

jewelsea
jewelsea

Reputation: 159536

If you can, I advise using Java 8 as:

  • JavaFX is on the default Java classpath in Java 8 but not in Java 7.
  • As JavaFX is on the default Java 8 classpath, you don't need a system path dependency on jfxrt.jar in your maven project.
  • As JavaFX is on the default Java 8 classpath NetBeans 7.4 should recognize JavaFX packages with no extra configuration.

You may also want to consider using the javafx-maven-plugin.

Upvotes: 4

Related Questions