2

I'm unable to run the Gluon JavaFx sample. I did all the step described with the exception of taking the newer Liberica JDK 11.0.2 instead of the preview and pointed the JAVA_HOME variable to the respective directory.

Executing the demo application using:

$JAVA_HOME/bin/java \
 --module-path=/opt/armv6hf-sdk/lib \
 --add-modules=javafx.controls \
 -cp target/classes/ \
 -Dprism.verbose=true \
 -Dembedded=monocle \
 -Dglass.platform=Monocle sample.Main

Gives me the following output and error:

Prism pipeline init order: es2 sw 
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Using system sized mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2_monocle
    succeeded.
GLFactory using com.sun.prism.es2.MonocleGLFactory
Dispman: Cannot open display
* failed to add service - already in use?

Any ideas, what there could be the problem? I found various tips on stackoverflow like additionally installing the following packages:

sudo apt install raspberrypi-ui-mods xorg libgtk2.0-0

or doing a firmware update using:

sudo rpi-update 192

even modifing the /etc/udev/rules.d/99-com.rules and adding:

SUBSYSTEM=="input*", PROGRAM="/bin/sh -c '\
 chown -R root:input /sys/class/input/*/ && chmod -R 770 /sys/class/input/*/;\
'"

did cause any change.

Has anyone a idea what I'm missing or can do to get that running?

  • Do you have a monitor plugged? Are you running from SSH or directly from the Raspberry Pi? Do you use X11 or command line? – José Pereda Jan 26 '19 at 18:18
  • Tried it with ssh and directly on the console... – Patrick Reinhart Jan 26 '19 at 21:29
  • The Liberica JDK already contains JavaFX, so you can simply try: `sudo $JAVA_HOME/bin/java -cp target/classes sample.Main`. Can you check if that works? – José Pereda Jan 26 '19 at 22:04
  • Unfortunately I still got the same result: `pi@raspberrypi:~/MaryHadALittleLambda $ sudo /opt/jdk-11.0.2/bin/java -cp target/classes sample.Main` `Dispman: Cannot open display` `* failed to add service - already in use?` pi@raspberrypi:~ $ /opt/jdk-11.0.2/bin/java -version openjdk version "11.0.2-BellSoft" 2018-10-16 OpenJDK Runtime Environment (build 11.0.2-BellSoft+7) OpenJDK Server VM (build 11.0.2-BellSoft+7, mixed mode) pi@raspberrypi:~ $ uname -a Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux – Patrick Reinhart Jan 27 '19 at 19:21
  • Liberica also runs from X11. Try to run `startx`, and then open a terminal to run `sudo $JAVA_HOME/bin/java -Djavafx.platform=gtk -cp target/classes sample.Main` – José Pereda Jan 27 '19 at 19:25
  • This worked fine. For my use case I search for a possibility to somehow start a Fx Application remote using SSH and a Monitor is attached to the HDMI port. Would this be possible? – Patrick Reinhart Jan 27 '19 at 19:42
  • Yes, of course. I typically use it always via SSH, but with a display connected, either via HDMI or the DSI connector. – José Pereda Jan 27 '19 at 19:49
  • What is the correct way to start an application using SSH then? Did I something wrong with my Approach using a minimal installation? Is there a way to get more info when trying to run it remotely? – Patrick Reinhart Jan 27 '19 at 20:39
  • I don't know what went wrong in your case. Maybe you could try a regular Raspbian distribution, like [Raspbian Stretch with desktop](https://www.raspberrypi.org/downloads/raspbian/)? – José Pereda Jan 27 '19 at 20:45
  • Using the plain `2018-11-13-raspbian-stretch` and with the current `bellsoft-jdk11.0.2-linux-arm32-vfp-hflt.tar.gz` booting to promt only works perfectly.. – Patrick Reinhart Jan 28 '19 at 20:55
  • Good to know. That's the distribution I use too. Lite should have worked too, probably some driver was missing. – José Pereda Jan 28 '19 at 23:24

1 Answers1

1

Use latest raspbian-stretch image and install the actual Liberica JDK in the /optfolder.

To start a JavaFx application within the X11 environment use the following flags:

$JAVA_HOME/bin/java -Djavafx.platform=gtk -cp <actual-classpath> <main-class-name>

To start a JavaFx application via SSH or from command line use:

$JAVA_HOME/bin/java -cp <actual-classpath> <main-class-name>

Optionally you can add those flags to get more verbose infos:

-Dprism.verbose=true -Djavafx.verbose=true