Creating a kiosk app with JavaFX, Sun Ray, Solaris and yeah some middleware...
By leroyk on Feb 08, 2010
I set out to see how easy or doable it would be to create a kiosk system that could be used in a Minority Report type of display. Let me state this experiment is in its very very non-Minority Report stage. The first stage of this experiment was simply to create a display mechanism that could be used to broadcast images using Thin Client technology.
So I chose to create a JavaFX application that would talk to Rest based server I set up. Using JSON the JavaFX application would retrieve data to display on the thin client screen. Not to taxing but a good learning experiment.
So what did I learn. JavaFX is a great mechanism for doing this type of display. Sun Ray is a good platform for displaying the information. Note that the as the level of interactivity goes up (aka moving graphics) things can get interesting.
Additionally I learned that a JavaFX application can easily be started from the command line and integrated into a Sun Ray startup script. Hear is my sample script.
#1 /usr/openwin/bin/xset -dpms s off
#2 unclutter -root &
#3 cp /jfx/.javafx_eula_accepted $HOME/.
#4 cp /jfx/.javafx_ping_sent $HOME/.
#4 cd /jfx
#6 javafx -cp JavaFXApplication1.jar javafxapplication1.Main
Not the most complex or proper start script ever written but it got the job done. First thing you will notice is line #1. I used the xset command to disable the power management and screen saver options. This is non starter for a kiosk display. It must never be blank. Also with no mouse or keyboard attached to the Sun Ray you cannot wake it up.
Line 2 is the unclutter command. You can download and compile from http://www.filibeto.org/pipermail/sunray-users/2010-January/014592.html. Unclutter will hide the cursor if it detects no activity in a given period of time. Sucks seeing that big ole cursor sitting on the screen with no mouse to move it.
Lines 3/4 are needed because the kiosk mode of Sun Ray cleans the user directory (rightfully so) when the session is ends. Well JavaFX will ask the user to accept the usage terms every time it starts and does not find the two files in the users home directory. No keyboard or mouse equal headache.
Finally the line (#6) to start the JavaFX application. Use the properties tab in Netbeans to get the correct name for the Main entry point.
That is it not to bad overall for a simple display. Now to crank it up to see how far it will go before it breaks.