Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to build javafx project with maven

931470May 14 2012 — edited May 15 2012
Hi i have a simple example where i want to launch a javafx screen. i want to build using maven.. I have the following code, does anyone have any ideas how to get this configured??

App.java - contains my main class and launches the javafx code

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;

/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
Application.launch(ApplicationToLaunchJavaFX.class, null);
}
}

ApplicationToLaunchJavaFX - the stage to display (javafx code)

public class ApplicationToLaunchJavaFX extends Application
{

@Override
public void start(Stage stage) throws Exception {
stage.setTitle("Helllllllooooo");
stage.show();
}

}

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.A</groupId>
<artifactId>mavenproject1hellowworld</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>mavenproject1hellowworld</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>2.0</version>
<scope>system</scope>
<systemPath>C:\Program Files\Oracle\JavaFX 2.0 SDK/rt/lib/jfxrt.jar</systemPath>
</dependency>

</dependencies>
</project>
This post has been answered by jsmith on May 14 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 12 2012
Added on May 14 2012
6 comments
5,161 views