qazwsed
Posts: 2
Joined: Tue Aug 26, 2014 3:49 pm

Running program in another folder

Fri Sep 05, 2014 7:19 pm

I have made a program called "Led", using pi4j. The class file is located in the folder: home/pi/LedFolder

Now I want to make an executable script that runs the program located in the "LedFolder".

This is the code used to include the pi4j libraries, but how do I tell it to run the program from another folder?

Code: Select all

#!/bin/bash
sudo java -classpath .:classes:/opt/pi4j/lib/'*' Led

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: Running program in another folder

Fri Sep 05, 2014 7:59 pm

#!/bin/bash
cd home/pi/LedFolder
java -cp '.:/opt/pi4j/lib/*' Led
exit $?
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

Return to “Java”