private void
findResolvConf(String file) {
	InputStream in = null;
	try {
		in = new FileInputStream(file);
	}
	catch (FileNotFoundException e) {
		return;
	}
	InputStreamReader isr = new InputStreamReader(in);
	BufferedReader br = new BufferedReader(isr);
	List lserver = new ArrayList(0);
	List lsearch = new ArrayList(0);
	try {
		String line;
		while ((line = br.readLine()) != null) {
			if (line.startsWith("nameserver")) {
				StringTokenizer st = new StringTokenizer(line);
				st.nextToken(); /* skip nameserver */
				addServer(st.nextToken(), lserver);
			}
			else if (line.startsWith("domain")) {
				StringTokenizer st = new StringTokenizer(line);
				st.nextToken(); /* skip domain */
				if (!st.hasMoreTokens())
					continue;
				if (lsearch.isEmpty())
					addSearch(st.nextToken(), lsearch);
			}
			else if (line.startsWith("search")) {
				if (!lsearch.isEmpty())
					lsearch.clear();
				StringTokenizer st = new StringTokenizer(line);
				st.nextToken(); /* skip search */
				while (st.hasMoreTokens())
					addSearch(st.nextToken(), lsearch);
			}
		}
		br.close();
	}
	catch (IOException e) {
	}

	configureFromLists(lserver, lsearch);
}
private void findResolvConf ( String file ) { InputStream in = null ; try { in = new FileInputStream ( file ) ; } catch ( FileNotFoundException e ) { return ; } InputStreamReader isr = new InputStreamReader ( in ) ; BufferedReader br = new BufferedReader ( isr ) ; List lserver = new ArrayList ( 0 ) ; List lsearch = new ArrayList ( 0 ) ; try { String line ; while ( ( line = br . readLine ( ) ) != null ) { if ( line . startsWith ( "nameserver" ) ) { StringTokenizer st = new StringTokenizer ( line ) ; st . nextToken ( ) ; addServer ( st . nextToken ( ) , lserver ) ; } else if ( line . startsWith ( "domain" ) ) { StringTokenizer st = new StringTokenizer ( line ) ; st . nextToken ( ) ; if ( ! st . hasMoreTokens ( ) ) continue ; if ( lsearch . isEmpty ( ) ) addSearch ( st . nextToken ( ) , lsearch ) ; } else if ( line . startsWith ( "search" ) ) { if ( ! lsearch . isEmpty ( ) ) lsearch . clear ( ) ; StringTokenizer st = new StringTokenizer ( line ) ; st . nextToken ( ) ; while ( st . hasMoreTokens ( ) ) addSearch ( st . nextToken ( ) , lsearch ) ; } } br . close ( ) ; } catch ( IOException e ) { } configureFromLists ( lserver , lsearch ) ; }
Looks in /etc/resolv.conf to find servers and a search path.
"nameserver" lines specify servers.  "domain" and "search" lines
define the search path.