So I just installed the 'brightness' utility package using homebrew (its basically a way to adjust screen brightness through terminal), but I'm having a hard time running this code in java:
Process p = Runtime.getRuntime().exec("brightness -l");
When I run "brightness -l" through terminal, it gives the current screen brightness level. But when I try the line through java it throws this error:
Exception in thread "main" java.io.IOException: Cannot run program "brew": error=2, No such file or directory
I've tried the following:
Process p = Runtime.getRuntime().exec("/usr/local/bin/ brightness -l");
but it gives me a permission denied error:
Exception in thread "main" java.io.IOException: Cannot run program "/usr/local/bin/": error=13, Permission denied
So I guess it'll work if I grant permission to regular users to access bin. But thats too risky, is there any other way to do it?