...
IMPORTANT: Ensure that you do not have gradle plugins for NetBeans or Eclipse (for Eclipse specific gradle configuration, see below) installed. They will conflict with the pre-generated IDE files. In furtureIn the future, we may move to gradle builds within the IDE's as support becomes better.
Get a build of the
...
latest JDK
You should use the latest OpenJDK when developing OpenJFX as OpenJFX continuously bumps the minimum JDK version. You can use the latest stable version or early access builds which can be found on http://jdk.java.net/12/ (replace the number for later versions). Starting from JDK11, JavaFX/OpenJFX is not included in the JDK anymore.
If you are building and running native libraries, you need to make sure you use the same version of JDK for NetBeans that you use to build JavaFX with gradle. In particular, if you try to mix a 32-bit JDK and a 64-bit JDK, the binaries will fail to load.
Get an IDE that supports
...
the latest JDK
JDK9 brought modularization to the platform (including OpenJFX) and JDK10 brought Local-Variable Type Inference (AKA "var"). Later versions will bring more language changes. All these require IDE support, which means that you should always use the latest IDE versions, even early access builds. Not all IDEs will be able to advance equally in their support (some still have bugs with lambdas from JDK8), so keep in mind that there will be bugs. You are encouraged to work with your IDE's development team to resolve these.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://wwwdownload.eclipse.org/eclipse/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 the latest JDK version. This will be explained later on for each particular IDE. If If you use an IDE without JDK8 support, such as NetBeans 3.7.1current support, OpenJFX will not compile and you will not be able to run from within the IDE.
Pre-JDK11 Only: Delete jfxrt.jar (or move it to a different 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.
...
IMPORTANT: Do not skip this step. If you do, you will not be running the code in your IDE and will waste hours wondering why you make changes and they don't run.
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.
...
Run Sample Code with gradle built shared libraries
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:
...
//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 Eclipse projects have been created for you to use. You should use the latest Eclipse version, or at least 4.8 due to modular support.
IMPORTANT: The 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. (This might not be true anymore)
The steps to use Eclipse are:
- Import the Eclipse Projects
- Configure Eclipse to use JDK8 the latest JDK
- Run sample code
- Run sample code with grade built shared libraries
Import the Eclipse Projects
...
- Go to
File -> Import -> General -> Existing Projects into Workspace.
...
- Set the root directory to the base repository path (/
rt
by default). - Check
Search for nested projects.
- Optionally, you might find it convenient to work with Working Sets.
Configure Eclipse to use
...
Preferences->Java->Compiler->OK
Run Sample Code
the latest JDK
- Go to
Window -> Preferences -> Java -> Installed JREs
andAdd
and select the above version. If you want to find a regression or backport, you can switch to earlier versions here (will require rebuilding). You might see a warning that Eclipse does not support this Java version, this should not cause issues. - Go to
Window -> Preferences -> Java -> Compiler
and set the compiler compliance level to the latest (you will not have an option for an unreleased version of Java).
Building the workspace can take some time. However, thanks to Eclipse's incremental compiler, you do not need to rebuild all of it on every change.
NOTE: Dialog.java
in the controls module currently gives a compiler error because of a bug in Eclipse. It can be worked around be moving the erroneous line out of the lambda expression. Remember to ignore this change when working against a revision.
JUnit tests
Running a dependent project
Run Sample Code
Using Gradle
Eclipse has gradle support via Eclipse Buildship. Use the latest Buildship version as the gradle version used in OpenJFX updates from time to time. OpenJFX uses the gradle wrapper.
The project structure for gradle is such that the root directory (/rt
) contains the parent project with all other projects being its children.
NOTE: this process will override the projects' configuration and will cause them to not work anymore. However, since we are inside a mercurial repository, we can revert the breaking changes and keep the gradle settings. This will allow us to work with both Eclipse and gradle.
- Install Buildship.
- Go to
File -> Import -> Gradle -> Existing Gradle Projects.
- Set the root directory to the base repository path (/
rt
by default). Finish and wait for the workspace to rebuild. This will result in many compilation errors.
Revert all .classpath files (and clean and rebuild if it does not happen automatically - this will some take time). There should be no compilation errors.
What this process does is add the gralde nature and build command to the .project files. This means that these files are now different than the ones in the repo. Additionally, the .settings folder for each project will contain a Buildship pref file. You can hg forget
these to not interfere with development work.
Run Sample Code with Gradle Built Shared Libraries
...