I use a Raspberry Pi 3 Model B with Raspbian Jessie.
I have a java program that I want to compile and run on start-up. I figured I need to launch it through /etc/rc.local. I have a command to compile the java-files and one command to run them.
sudo javac -cp /home/pi/Desktop/MultiSensor_v2.0_Java/opencv-3.2.0-java/build/bin/.jar /home/pi/Desktop/MultiSensor_v2.0_Java/.java
sudo java -Djava.library.path="/home/pi/Desktop/MultiSensor_v2.0_Java/opencv-3.2.0-java/build/lib" -cp "/home/pi/Desktop/MultiSensor_v2.0_Java/opencv-3.2.0-java/build/bin/opencv-320.jar:/home/pi/Desktop/MultiSensor_v2.0_Java/" Main &
When I run these commands from the terminal it works perfectly. I tried to put these commands in the /etc/rc.local file before exit 0. On reboot, the compilation works but the actual program never executes. How do I get my java program to run upon startup using the two commands above?