When I run commands from the console everything is OK:
sudo -u oracle fgrep ...
ProcessBuilder pb = new ProcessBuilder("bash", "-c", command);
Process shell = pb.start();
InputStream is = shell.getInputStream();
Since you say
chmod 775 for log file it works, it's obvious your process doesn't have permission.
You can run your java with sudo:
sudo java ClassFileName
Or just add
sudo as the first string in the array that you pass to bash process:
command="sudo -u oracle "; //command=commandname; //command[2...n]=Other params;
oracle is in sudoers list and won't ask for password, this will run just like how it runs in commandline when you use