Basic HTML version of Foils prepared 17 Nov 97

Foil 45 URL objects in Java

From Java Tutorial, July 1, 1996 CEWES Tutorial, CPS606, JSU Class CSC499 -- July 22-25 1997, Fall 97. by Nancy J. McCracken,Geoffrey C. Fox, Tom Scavo


1 The class java.net.URL has methods to create and manipulate URL objects:
2 String urlStr = "http://www.npac.syr.edu/";
3 try {
  • URL url = new URL( urlStr );
4 } catch ( MalformedURLException e ) {
  • System.err.println( "Bad URL: " + urlStr );
5 }
6 The document at this URL may be displayed in the current browser window with:
7 getAppletContext().showDocument( url );
8 Another version of showDocument(...) permits the document to be loaded into an arbitrary HTML frame.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998