This is a common problem from what I see, but I tried to incorporate some of the suggestions provided. None worked for me. Am I making a mistake here? This is what I am trying to do.
String[] comd1 = { "/bin/sh", "-c", "sesearch", "--allow -s "+tokens[1]," -t "+tokens[2].split(":")[0]," -c "+tokens[2].split(":")[1]," -p "+tokens[3].replace(";","")," sepolicy" };
Process pp = Runtime.getRuntime().exec(comd1);
stdInput = new BufferedReader(new InputStreamReader(pp.getInputStream()));
String temp, status = null;
boolean flag = false;
while ((temp = stdInput.readLine()) != null)
{
if(temp.contains("Found ") || temp.equals("") || temp.contains("Usage"))
{
}
else
flag = true;
}
if(flag) status="Yes"; else status="No";
The flag which is initially set to false, is always false. It never sets to true. I have tried nearly every combination of the comd1 string array.
Please help.