I'm working on the Pi4J project (https://v2.pi4j.com/) to control GPIOs with a Java application. Pi4J uses a native library to communicate with the GPIOs. For some protocols (like I2C) the library needs to be called with "sudo". I know this is a bad idea and should be avoided, and we are looking for an alternative solution, but in the mean-time I found out you can't run or debug a Java application in VSC as sudo.
You could launch VSC itself as sudo, but this gives the following warning, so that's probably even a worse idea ;-)
$ sudo code
You are trying to start Visual Studio Code as a super user which isn't recommended. If this was intended, please specify an alternate user data directory using the `--user-data-dir` argument.
I'm working on the Pi4J project (https://v2.pi4j.com/) to control GPIOs with a Java application. Pi4J uses a native library to communicate with the GPIOs. For some protocols (like I2C) the library needs to be called with "sudo". I know this is a bad idea and should be avoided, and we are looking for an alternative solution, but in the mean-time I found out you can't run or debug a Java application in VSC as sudo.
You could launch VSC itself as sudo, but this gives the following warning, so that's probably even a worse idea ;-)
Environment
Steps To Reproduce
"sudo": true
Current Result
sudo setting not available
Expected Result
sudo true/false can be defined
Additional Informations
The example project is https://github.com/Pi4J/pi4j-example-crowpi