1

I have Raspbian installed on my Pi 3. I am trying to develop a JavaFX application which needs to send and receive data over serial interface so I use PI4J. Now i have a few problems when running this application on my Pi.

  • The program takes a very long (abnormal long in my oppinion) time to open/execute.
  • My GUI is always on fullscreen. If the frame doesn't have the size of my screen, the rest is filled with black bars. Moreover, there is no minimize, maximize or close button on the right top corner like it is when running a swing application on the Pi.

So my question is:

  • Should I change my operating system / Will it work better on other operating systems?
  • Is it possible to run my JavaFX application without fullscreen and with the normal minimize, maximize and close buttons on the right top corner (like I can with swing applications)? It is really disruptive to run a application without the ability to check the console for any errors.

I have already added a key-combination for exiting my application but sometimes (if there is an error in my program) there is just a black bar filling the screen without the ability to exit.

1 Answer 1

2

Fortunately, You don't need to change operating system.

You can use gtk2 platform, which works fine on my Raspberry Pi 3. Simply run you Jar application with this command:

$JAVA_HOME/bin/java -Djavafx.platform=gtk2 -jar MyJavafxApp.jar

With this command it won't go on fullscreen, it opens regular frame, and You can see also the console while Your app is running. Similar problem: https://www.raspberrypi.org/forums/viewtopic.php?t=174409

And with the starting time - maybe increasing gpu memmory will help You. Just add this line to /boot/config.txt:

gpu_mem=128

or use other value (it's in MB) but be careful - it will decrease memmory of CPU! (128 MB for GPU is enough for my need. My JFX app, where I use styles and some little pictures, starts in 4 seconds.) Read this for more info about the config: https://elinux.org/RPiconfig

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.