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

    Loading...
  1. Dashboard
  2. Undefined Space
  3. OpenJFX
  4. Using an IDE

Using an IDE

  • Created by Steve Northover, last modified on Oct 22, 2014

Tools are a big part of being a productive developer on OpenJFX and we aim to provide excellent support for all three major IDEs: NetBeans, IntelliJ IDEA, and Eclipse. Regardless of which development environment you prefer, you should find it easy to get up and running with OpenJFX. We hope you will return the favor by submitting patches and bug reports!

This section assumes that you have already succeeded in Building OpenJFX. A gradle build must complete before IDE support will fully work (otherwise your IDE will just be a glorified text editor with lots of red squiggles!). Specific instructions for using each IDE is provided below, followed by a discussion on Developer Workflow, Using Mercurial, and Communication with other members of the team. Further information on how we work can be found under Code Style Rules.

IDE Pre-Requirements

Despite the fact that most of the major IDE's support gradle directly, we have decided to provide pre-generated IDE configuration files in order to make using an IDE smooth and painless. As the IDE's support for gradle improves, we may be able to update these instructions to rely on that support instead of the checked-in project files that we have today.

IMPORTANT: Ensure that you do not have gradle plugins for NetBeans or Eclipse installed. They will conflict with the pre-generated IDE files.  In furture, we may move to gradle builds within the IDE's as support becomes better.

Get a 32-bit version of the JDK

If you are building and running native libraries, the current native build produces 32-bit libraries. If you attempt to use them in a 64-bit JVM, they will fail to load and presently do not provide much indication about what went wrong. The easiest thing to do is to use a 32-bit JVM. This is not necessary on platforms like Mac that only support 64-bit JVM's.

Get an IDE that supports JDK8

OpenJFX is based on JDK1.8 and IDE support for lambdas and default methods may require that you get a pre-release version of the IDE you choose

NetBeans: https://netbeans.org/downloads/

IntelliJ: http://www.jetbrains.com/idea/download/

Eclipse: http://www.eclipse.org/downloads/index-java8.php

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, OpenJFX will not compile and you will not be able to run from within the IDE.

Move jfxrt.jar to the cache directory

JavaFX is bundled with the JDK as an extension. The jfxrt.jar is located in the extension directory called 'ext' where Java is installed. You must remove it from this directory for the IDE's to work properly. The issue is this: If jfxrt.jar is in the extension directory, it will get seen before the code in your IDE. This means you won't be running or testing the code in your IDE. For more information on why this is a problem, see Unique Challenges of Working on the JDK.

By moving jfxrt.jar to a standard cache directory, your IDE can reference it to find binary versions of classes that are not yet open source.  Further, when both jfxrt.jar and your IDE reference a class, the class from the IDE will be chosen.

To move jrxrt.jar to the standard cache directory:

  • cd <PATH TO JFX>
  • mkdir -p caches/sdk/rt/lib/ext
  • mv <PATH TO JDK>jre/lib/ext/jfxrt.jar caches/sdk/rt/lib/ext

Using NetBeans

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 Platform
  • Import NetBeans projects
  • Rebuild
  • Run sample code
  • Run sample code with grade built shared libraries

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.

# 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 Platform

Invoke Tools->Java Platforms

Import the NetBeans Projects

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

Rebuild

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 with gradle built shared libraries

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

Using IntelliJ IDEA

IntelliJ is a popular IDE that is used by many committers to develop JavaFX code.  An IntelliJ project has been created for you that you need to open.  The steps to use IntelliJ are:

  • Open the IntelliJ Project
  • Make 
  • Run sample code
  • Run sample code with grade built shared libraries

Open the IntelliJ Project

IMPORTANT:  Open IntelliJ on the 'rt' directory exactly as indicated in the image above.

Make

Build->Make Project

Run Sample Code

Run Sample Code with Gradle Built Shared Libraries

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

Using Eclipse

Eclipse is a popular IDE that is used by many committers to develop Java code.  Eclipse projects have been created for you to use.

IMPORTANT:  The location of the mercurial repository (<PATH TO JFX>) must not be inside the Eclipse workspace directory.  If it is, nothing will compile and work.

The steps to use Eclipse are:

  • Import the Eclipse Projects
  • Configure Eclipse to use JDK8 
  • Run sample code
  • Run sample code with grade built shared libraries

Import the Eclipse Projects

Import->General->Existing Projects into Workspace

Check 'Search for nested projects

Configure Eclipse to use JDK8

Preferences->Java->Compiler->OK

Run Sample Code

Run Sample Code with Gradle Built Shared Libraries

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

//TODO - these are the VM Arguments: -Djava.library.path=${workspace_loc:rt}/build/mac-sdk/rt/lib


Overview
Content Tools
ThemeBuilder
  • No labels

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.21
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 174, "requestCorrelationId": "51dd9eec2ea2b3ea"}