7 Replies Latest reply: Jan 14, 2013 5:41 AM by EJP RSS

    How to use OpenURI

    981950
      **
      Am trying to periodically browse a file, stats.htm, from within Java using the OpenURI class.

      So far I keep getting one version of the file - the one when first accessed. Repeated calls
      to the browse() method in code below gives me the same original version of stats.html
      NOT the version with the stats updated.

      The code is:

      public class OpenURI
      {
      static String arg = "G:/swm49/agents/stats.htm";
      public void OpenURI()
      {
      System.out.println("about to open URL");
      }
      public void browse()
      {
      java.awt.Desktop desktop = java.awt.Desktop.getDesktop();

      if( !desktop.isSupported( java.awt.Desktop.Action.BROWSE ) )
      {
      System.err.println( "Desktop doesn't support the browse action (fatal)" );
      System.exit( 1 );
      }
      try
      {
      java.net.URI uri = new java.net.URI( arg );
      desktop.browse( uri );
      }
      catch ( Exception e )
      {
      System.err.println( e.getMessage() );
      }
      }
      }