Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static String getDns() { try { Process p = Runtime.getRuntime().exec("getprop net.dns1"); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String dns = in.readLine(); return dns; } catch (IOException e1) { e1.printStackTrace(); } return null; } }