0

I have a server running on Java using the library Pi4j to control the RaspberryPi's GPIOs and a file on which I write the current GPIOs' statuses. When I run the code from IntelliJ IDE everything works just fine.
But when I create the .jar file and run it like

sudo java -jar server.jar

It works fine updating the file, but the GPIOs do not change their status.
When I do

java -jar server.jar

The GPIOs correctly change their status but I get the error java.io.FileNotFoundException: relStat.txt (Permission denied)


My file permission are all set to anyone, so anyone should be able to read, modify and run it. Why does this happen?

CrystalSpider
  • 377
  • 7
  • 16

1 Answers1

0

This is a permission issue, The file owner is the "pi" user. Which user you are running under?

Rami Khawaly
  • 126
  • 3
  • 14