...
- Make sure to expand the filesystem, or you won't have enough room to install the JDK.
- If you are using the device primarily with JavaFX, you will probably not want to select "Enable Boot to Desktop". JavaFX on the Pi takes over the whole screen and does not interact with the Linux desktop.
- Under "Advanced Options" you can select "Memory Split" to allocate memory to the graphics processor. A 50/50 split will let you get most use out of JavaFX accelerated graphics.
- If you are using JavaFX over ethernet, it can be convenient to turn on the SSH server under "Advanced Options". Since JavaFX takes over input devices, it can be hard to stop an application if you don't have an SSH connection to it from another machine.
Tip |
---|
If you are connecting to your Pi over the network, you can save some time by setting a host name for it in |
If the Raspberry Pi isn't detecting the screen size correctly, you might need to tweak video mode settings and maybe tell the Pi to ignore the capabilities reported by the display.
...
JDK 8 EA builds for the Raspberry Pi include full support for hardware accelerated graphics, with everything from the base, graphics, controls and FXML modules. Media and Web modules are not included.
Stopping an application
JavaFX on the Raspberry Pi takes over the whole screen and captures all Linux input devices. While this will generally be the behavior you want in a deployed application, it is less convenient for development because you can't stop an application using control-C unless the JavaFX application has a KeyEvent handler that listens for control-C and calls Platform.exit()
. There's nothing unusual about this - many Linux fullscreen console applications have the same behavior - but it is often useful to have a quick way to end an an application during development without changing the application code.
There are two ways to run applications with the ability to be terminated by control-C:
- Run applications over an ssh connection from a PC. This gives most control over the device, because once you have ssh connections set up then you can use them for other purposes as well.
- Alternatively, you can use a built-in debugging feature to trap control-C. If you set the environment variable
JAVA_DEBUG=1
before starting Java then JavaFX will exit when you press control-C. For example
Code Block | ||||
---|---|---|---|---|
| ||||
JAVAFX_DEBUG=1 /opt/jdk1.8.0/bin/java -cp Stopwatch.jar stopwatch.MainScreen |
Warning |
---|
The |