I need to run a Java JAR Swing GUI executable in a Raspbian Wheezy Debian distribution inside an ARM device during boot time.
I am following this as reference with myapp,myapp-start.sh and myapp-stop.sh, and this with possible solutions (and others more quite similar). But here is not reference to the DISPLAY variable.
Ive checked a lot of alternatives, with
Tried and not applicable Options:
/usr/bin/java -jar -Djava.awt.headless=true $myapp.jarunset DISPLAY(insidemyapp-start.sh, above thejava -jarsentence)
Errors:
java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it.
Tried Options (inside myapp-start.sh, above the java -jar sentence):
export DISPLAY=:0export DISPLAY=:0.0export DISPLAY=localhost:0.0
Errors:
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable...Client is not authorized to connect to ServerException in thread stack...
Untried Options
ssh - X localhost: How should i do ansshto theX11server? Where should i execute that under aninit.dprocess?. Is that the standard solution for running a Java program with GUI?.USER=rootinsidemyapp-start.sh: Theinit.dstops, and request password. So smart, the process don`t start.- Should any of the options above to be included in another place than the
myapp-start.shcode? Where?
Should not be simpler to run a single piece of code at startup?.
Any other option, will be appreciated.
EDIT 2015-04-12
New Options
In the following options, i am adding a code inside this location /etc/xdg/lxsession/LXDE-pi/autostart for execution after the default user pi logs and X11 starts (see jlliagre suggestion):
usr/bin/java -jar /home/pi/Embedded/bin/PowerBar.jar(no ampersand)export DISPLAY=:0.0usr/bin/java -jar /home/pi/Embedded/bin/PowerBar.jar(no ampersand)/bin/bash /home/pi/Embedded/bin/powerbarstart.sh(no ampersand)
All them start the application in the background, that is, the background music is played, and the graphics are available only through a VNC at :0 (using TightVNC).
As side effect, the screensaver activates, and the application freezes, each 60 seconds approx. Please note this same location is also used to disable the screensaver.
Is there a missing option, or symbol, I am not including?.
Solution
The device was configured as :1.0 instead of :0.0. Changing this on the myapp-start.sh solved the issue.