Here is an example of what you could do:
The Pi needs to be configured to launch the desired app at startup. Lets assume that our app is called javafile.jar.
In order to do this:
- Create a file named /etc/xdg/autostart/startup.desktop
Put the following contents into it
[Desktop Entry] Type=Application
Name=JavaApplication
Exec=/user/home/jre/java -jar javafile.jar
Restart.
Another way to do this is to have the exec line call a script in your home folder that launches your java app instead of calling the app directly. You can create a file called javalauncher in your home directory with the following contents:
#! /usr/bin/bash
#my java launcher file
/user/home/jre/java -jar javafile.jar
Then update your exec entry in the startup.desktop file to call the javalauncher command file like so:
[Desktop Entry] Type=Application
Name=JavaApplication
Exec=/user/pi/home/javalauncher
Remember to chmod +x on your javalauncher file.
startlxde-pi
script and reselect that option. However, it may be that you will need the XServer running in order to display the Java VM output - I am not too familiar with that system - in which case I think you will want to investigate what thestartx
andxinit
script do. – SlySven Dec 28 '15 at 1:06