try { URL u = new URL("http://www.oreilly.com/"); URLConnection uc = u.openConnection(); System.out.println(uc.getURL()); } catch (IOException e) { System.err.println(e); }