Thursday, August 7, 2014

Run GUI based application on raspberry Pi Startup




          Belief me i went through several websites and tested many proposals to run my JAVA based GUI application on Raspberry Pi start-up. Finally the following worked out

First check inside the .config folder if it contains autostart folder or not , if not then create a folder named as autostart.



Create a myApp.desktop file inside the autostart folder.The myApp.desktop file should contain the following


[Desktop Entry]

Encoding=UTF-8

Typr=Application

Name=nds

comment=

Exec=sudo /usr/bin/java -classpath /home/pi/:/home/pi/Desktop/Display_lib/*.jar -jar /home/pi/Desktop/Display.jar

StartupNotify=false

Terminal=false

Hidden=-false



Thats all reboot your pi and your application should run now..... You can also do that by following method.. edit rc.local file and put the code just befor the exit 0.
#sudo  /usr/bin/java -classpath /home/pi/:/home/pi/Desktop/Display_lib/*.jar -jar /home/pi/Deskt/Display.jar
Another thing is to run the GUI app continuously you also need to disable the default screen blackout. To do that just edit the rc.local file and put the following codes.
setterm -blank 0 -powerdown 0 -powersave off

Or edit the ~/.xinitrc file and put the following codes..
. /etc/X11/Xsession

xset s off

xset -dpms

xset s noblank

Pi Rocks...


setterm - terminal blanking

On a per session basis, you can run:
setterm -blank 0 -powerdown 0
This will set the timeout of your monitor to 0, which will prevent it from going to sleep.
If you get yelled at about permissions, try "sudo setterm" instead.
You might not want to enter these commands every time you boot up your Pi. In this case, open up your .bashrc file (or .extras or other custom file you might use).
nano ~/.bashrc
At the end of the file add a new line with the setterm command you entered before.
setterm -blank 0 -powerdown 0
Hit ctrl+x to exit, 'y' to save your changes and enter to save the file.
Note: the default value for the -blank option is 0 so it may be excluded
Now when you boot up, your monitor will never sleep.

kbd configuration - terminal blanking

Open up your configuration:
sudo nano /etc/kbd/config
Find the line for BLANK_TIME and POWERDOWN_TIME and set them to 0.
BLANK_TIME=0
POWERDOWN_TIME=0
If these lines doesn't exist go ahead and add them.

lxde configuration - Xsession blanking

The previous methods should work for the terminal. This method should prevent your screen saver from coming on in the GUI.
Open up your lxde autostart file:
sudo nano /etc/xdg/lxsession/LXDE/autostart
If your Pi is newer, the file you'll need to change may be:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Add these lines:
@xset s noblank
@xset s off
@xset -dpms

lightdm configuration - Xsession blanking

If adding those settings to your LXDE autostart didn't work, this might help if you're booting straight into the GUI.
Open your lightdm configuration:
sudo nano /etc/lightdm/lightdm.conf
Anywhere below the [SeatDefaults] header, add:
xserver-command=X -s 0 -dpms
This will set your blanking timeout to 0 a



sudo apt-get install x11-xserver-utils
  • now lets make a file to run on the start of X with settings
cd /home/pi 
touch .xinitrc
nano .xinitrc
  • Now you should edit .xinitrc and add these lines (disable ss, say no monitor timeout, set no blanking)
xset s off 
xset -dpms 
xset s noblank 

No comments:

Post a Comment