Peter Pilgrim is professional software developer, designer and architect. Since 1998 he has worked in the financial services industry, investment banking mainly, developing IT for clients. He is a well known specialist in Java Enterprise Edition (Java EE) technology, focused on the server-side and the implementation of electronic commerce. Peter has built professional Java EE apps for top-tier investment banks such as Lloyds Banking Group, UBS, Credit Suisse, Royal Bank of Scotland and Deutsche Bank. Peter is the 91st Oracle Java Champion. Peter is a DZone MVB and is not an employee of DZone and has posted 34 posts at DZone. You can read more from them at their website. View Full User Profile

Install JavaFX Runtime Into Local Maven Repository

10.18.2011
| 5636 views |
  • submit to reddit

In order to get JavaFX 2.0 to work with a Maven Repository, requires some fudge factor. Because one cannot simply redistribute JavaFX Library, you have to install the libraries manually into a local Maven repository.

This is my MSDOS command script to do it:

REM Installing Oracle JavaFX 2.0 Runtime into a Local Maven Repository
REM Based on the information from JFXtras 2.0 Project
REM http://code.google.com/p/jfxtras/wiki/ContributorGettingStarted
REM Peter Pilgrim 12th September 2011 in Crete
 
REM set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_27
REM set javafx.home=C:\Program Files\Oracle\JavaFX 2.0 SDK
REM set JAVAFX_HOME=C:\Program Files\Oracle\JavaFX 2.0 SDK
REM set javafx.home=%JAVAFX_HOME%
REM set USERPROFILE=C:\Users\Peter
 
REM Install the JavaFX Java Library
call mvn install:install-file -Dfile="%javafx.home%\rt\lib\jfxrt.jar" -DgroupId=com.oracle -DartifactId=javafx-runtime -Dversion=2.0 -Dpackaging=jar
 
pushd "%javafx.home%\rt\bin"
del /f /q %USERPROFILE%\Documents\javafx-dll-temp-bin.jar
"%JAVA_HOME%\bin\jar" -cf  %USERPROFILE%\Documents\javafx-dll-temp-bin.jar *.dll
popd
 
REM Install Native libraries
call mvn install:install-file -Dfile=%USERPROFILE%\Documents\javafx-dll-temp-bin.jar -DgroupId=com.oracle -DartifactId=javafx-runtime -Dversion=2.0 -Dpackaging=jar -Dclassifier=windows
 
REM Copy the binaries to the Maven Local Repository
call copy "%javafx.home%\rt\bin"  C:\Users\Peter\.m2\repository\com\oracle\javafx-runtime\bin
 
REM End.

Once you have the local repository set up, once include a Maven dependency into a project like this:

<dependencies>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>javafx-runtime</artifactId>
        <version>2.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>
</dependencies>

Thus the group is com.oracle, the artifact id javafx-runtime, and the version is 2.0.

There you go.

 

From http://www.xenonique.co.uk/blog/?p=497

Published at DZone with permission of Peter Pilgrim, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Christian Schli... replied on Wed, 2011/10/19 - 1:53am

I prefer using system scope. I have set up a maven archetype for this: http://truezip.schlichtherle.de/2011/10/04/updated-maven-archetype-for-javafx-2-0-in-scala/

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.