Basic HTML version of Foils prepared Sept 21 1998

Foil 45 URL objects in Java

From Java Tutorial 98- 4: Multi-Treading, Useful Java Classes, I/O and Networking NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken


1 The class java.net.URL has methods to create and manipulate URL objects:
  • String urlStr = "http://www.npac.syr.edu/";
  • try {
  • URL url = new URL( urlStr );
  • }
  • catch ( MalformedURLException e )
  • { System.err.println( "Bad URL: " + urlStr );}
2 The document at this URL may be displayed in the current browser window with:
  • getAppletContext().showDocument( url );
3 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 Sat Nov 28 1998