I researched this question and all answers suggest visudo to add:
Defaults:user !requiretty

It does not work!

I have two Linux boxes (RedHat). I have a Java class which uses ProcessBuilder/Process to execute commands. The class runs under a system account.
On both boxes, I run 

```
su other-user -c 'some-command'

```

and provide the password for other-user in an input stream to the Process object.

On one box, the command succeeds and on the other I get the error above.
The sudoers files on both machines did not have exclusions for requiretty ('Defaults requiretty' is set on both files).
I tried adding the exclusion as suggested by the answers I found. I tried both the system user running the process and 'other-user'... 

Does not work.

What else can be the issue? Do I need to restart the system after adding the requiretty exceptoin(s)?