I'm using the following Code
public void getIPTableRules(){
ProcessBuilder pb = new ProcessBuilder("/sbin/iptables", "-L");
try {
Process p = pb.start();
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
int lineCount = 0;
String zeile;
while ((zeile = input.readLine()) != null) {
System.out.println(zeile);
System.out.println(lineCount);
line[lineCount] = zeile;
lineCount++;
}
input.close();
} catch (IOException ex) {
Logger.getLogger(CheckFirewall.class.getName()).log(Level.SEVERE, null, ex);
}
}
The System.out's are printed correctly. The Variable line is set in the Class like:
public String line[];
The Exception occurs in the Line:
line[lineCount] = zeile;
So can someone please tell my what i'm doing wrong...