public static void main(String[] args) {
		//Create a command.
		StringBuffer command = new StringBuffer("nslookup");
		if(args != null){
			for(int i = 0; i < args.length; i++){
				command.append(" ");
				command.append(args[i]);
			}
		}
		System.out.println(command.toString());
		//Execute a child process.
		Process child = null;
		try {
			child = Runtime.getRuntime().exec(command.toString());
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		//Read a result of the child process.
		InputStream tempIn = child.getInputStream();
		InputStreamReader r = new InputStreamReader(tempIn);
		BufferedReader in = new BufferedReader(r);
		OutputStream tempOut = System.out;
		OutputStreamWriter w = new OutputStreamWriter(tempOut);
		BufferedWriter out = new BufferedWriter(w);
		
		String line;
		int lineNumber = 1;

		try {
			while((line = in.readLine()) != null){
				System.out.println(lineNumber + " " + line);
				lineNumber++;
			}
			if(child.waitFor() != 0){
				throw new Exception("Child process has failed.");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}