• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. OpenJFX
  4. Building OpenJFX

Page History

Versions Compared

Old Version 30

changes.mady.by.user Steve Northover

Saved on Jun 27, 2013

compared with

New Version 31

changes.mady.by.user Steve Northover

Saved on Jun 27, 2013

  • Previous Change: Difference between versions 29 and 30
  • Next Change: Difference between versions 31 and 32
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Once you have downloaded and installed an IDE that is JDK8 aware, you will need to configure it to accept JDK8 syntax and generate the right byte codes.  This will be explained later on for each particular IDE.  If you use an IDE without JDK8 support, such as NetBeans 3.7.1, you will not be able to run from within the IDE.

Remove jfxrt.jar from the JDK

...

Many commiters are using NetBeans to develop Java and native code.  NetBeans projects have been configured for both.  Native projects in NetBeans are currently not configured to build using either Make or gradle, however ant build works in NetBeans and will build the classes and jar files needed for the IDE.
Here are the steps to use NetBeans:
  • Edit netbeans.conf
  • Invoke NetBeans
  • Add the JDK8 
  • Import NetBeans projects
  • Rebuild
  • Run sample code
  • Run sample code with grade built shared libraries (optional)

Edit netbeans.conf

We have found the nightly versions of NetBeans to be unstable under JDK8, but fine otherwise.  Further, NetBeans needs to be told not to report errors when private JDK classes referenced.  The netbeans.conf file is located in the etc directory of your NetBeans install.  You will edit netbeans_default_options and netbeans_jdkhome.

  • Change netbeans_default_options to remove "-J-ea" and add "-J-da -J-DCachingArchiveProvider.disableCtSym=true".  It does not hurt to increase memory using "-J-Xmx1024m".
  • Change netbeans_jdkhome to point to a JDK7 JVM.

Here is a sample file from the Mac.  The Windows and Linux default options might be a bit different.

Code Block
# Options used by NetBeans launcher by default:
# (can be overridden by explicit command line switches)
#
# Note that default -Xmx and -XX:MaxPermSize are selected for you automatically.
# You can find these values in var/log/messages.log file in your userdir.
# The automatically selected value can be overridden by specifying -J-Xmx or
# -J-XX:MaxPermSize= here or on the command line.
#
# If you specify the heap size explicitly, you may also want to enable
# Concurrent Mark & Sweep garbage collector.
# (see http://wiki.netbeans.org/FaqGCPauses)
#
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Xmx1024m -J-da -J-DCachingArchiveProvider.disableCtSym=true -J-Dnetbeans.logger.console=true -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes"
# Default location of JDK:
# (set by installer or commented out if launcher should decide)
#
# It can be overridden on command line by using --jdkhome <dir>
# Be careful when changing jdkhome.
# There are two NetBeans launchers for Windows (32-bit and 64-bit) and
# installer points to one of those in the NetBeans application shortcut 
# based on the Java version selected at installation time.
#
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home"

Invoke NetBeans

Note that before you invoke NetBeans, you may need to clear your old defaults and start with a fresh NetBeans install or you might get errors.

Add the JDK8 Configuration

Invoke Tools->Java Platforms
Image Added

Import the NetBeans Projects

Open Project... (you may need to resolve missing junit jars, don't need open web or builders for now)
<IMAGE>Image Added

Rebuild

<IMAGE OF NB WITH NO RED SQIGGLES>
   - wait, it takes forever (currently builders and web have errors - ignore them)
This might take quite a long time depending on how fast your machine it.  There should be no red marks on any of the projects.

Run Sample Code

Here is some sample code that was hooked up to use the base, graphics and controls projects. When saved, these projects were built by the IDE and the same code executed using the source in the IDE.

Run Sample Code

Create<IMAGE>
   - ... create a new project, set dependencies, set library path so correct DLL's are used ...

Run Sample Code with gradle built shared libraries

<IMAGE>
*THE FOLLOWING IS NO LONGER TRUE*

Once you are setup and ready to go, the first thing you should do is generate the project files for your preferred IDE.

Code Block
gradle netBeans
Code Block
gradle idea
Code Block
gradle eclipse

You can then leave the command line (hopefully forever!) and do all the rest of your work from within your IDE. No, really!

Image Removed

The "Gradle Support" module for NetBeans 7.3 was previously installed in my NetBeans instance. After running 'gradle netBeans', I then opened the javafx project with NetBeans and all of JavaFX is available for me and ready to go, even including native code. Its all there.

Image Removed

In order to perform a build from NetBeans, you simply have to hit the build button. To run a specific file (such as a sample), find the sample in the source tree (NOTE: Samples not setup yet as of 3/23/2013), right click and choose "run".

The experience in IDEA is similar. After running 'gradle idea', you open the "javafx" project. We will have already generated the project, workspace, and module settings for you. Many settings will have already been configured to be shared across all developers working on the project, such as the number of spaces per indent and the use of spaces instead of tabs.

Image Removed

IDEA and Eclipse differ from NetBeans in that they maintain their own compiled classes and maintain their own build. That is, while you can (and need to at times) run the Gradle build script in order to build, for example an SDK or the JavaDoc for the entire project or run all of the tests in the right way, most of the time you will end up just working in IDEA like you would for any other project. There are caveats though (such as making sure the JDK you have configured for the project does not have jfxrt.jar on its classpath!). This will all be documented separately.

Image Removed

You can setup a run configuration for any gradle tasks you want to. In this screenshot above, IDEA has been configured to execute the top-level clean run target. You can specify any environment variables or Gradle properties to feed to the build. This can be very convenient when you have different configurations you want to build for (for example, you might have a configuration for building normally and another for building iOS or ARM).

Most of the time you will be able to just work from within your IDE, doing building and testing. Even when you need to execute actually tasks in the OpenJFX Gradle build script, you can do it easily from within the IDE. However, for the sake of understanding the nuts and bolts (and to avoid having to take screenshots from all three IDEs for the rest of this document), I will switch to executing all commands from the command line. In fact, one of the advantages to Gradle over Ant is the fantastic command line interface it provides.

...

//TODO - explain how to hook up the shared libraries in the run dialog

Using The Command Line

Before diving directly into building OpenJFX, lets get our feet wet by learning what kinds of things we can call from the command line, and how to get help when we need it. The first command you should execute is tasks:

...

Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 647, "requestCorrelationId": "9616c6940b05fe52"}