[kepler-dev] Re: kepler/src/util/Browser.java

Christopher Hylands Brooks cxh at eecs.berkeley.edu
Wed Feb 11 10:39:40 PST 2004


I took a look at this, and it is a bit of a mess.

What we would like to do is to have it so that BrowserLauncher
will optionally open a URL in a separate browser, and
the browser will be the user's selected browser.

The short answer is that it would not be easy.

The longer answer is that ptolemy/actor/gui/BrowserLauncher.java
is from http://browserlauncher.sourceforge.net/
and under Windows NT and later, it calls Runtime.exec() with

    cmd /c start "" http://ptolemy

This seems to bring up the web page in the browser, replacing the
current page.

I found various references to people wanting to bring up a separate
browser, but no good code.

There are mentions of running
    rundll32 url.dll,FileProtocolHandler http://www.microsoft.com
but there are various issues.

http://www.jsiinc.com/SUBI/tip4100/rh4162.htm says

--start--
How can I open a URL from the Windpws 2000 command line?


rundll32.exe url.dll,FileProtocolHandler http://www.jsiinc.com

OR
rundll32.exe url.dll,FileProtocolHandler
http://www.jsiinc.com/reghack.ht%6D

OR
start www.jsiinc.com

OR
start www.jsiinc.com/reghack.htm

NOTE: Rundll32 doesn't like .htm or .html files, which is why .ht%6D
works, %6D is the hexidecimal code for m.

NOTE: The above commands will use an existing browser window if one
exists.

To always open a new browser window:

"C:\Program Files\Internet Explorer\IEXPLORE.EXE" www.jsiinc.com

OR
"C:\Program Files\Internet Explorer\IEXPLORE.EXE"
www.jsiinc.com/reghack.htm

To open the browser window at a fixed location and size:

"C:\Program Files\Internet Explorer\IEXPLORE.EXE"
javascript:window.resizeTo(1194,960);window.moveTo(80,5);location.href="http://www.jsiinc.com/reghack.htm"

NOTE: rundll32.exe url.dll,FileProtocolHandler www.jsiinc.com also works.
--end--

However
http://support.microsoft.com/default.aspx?scid=kb;en-us;283225
says that the above is obsolete

The Microsoft article discusses querying the registry and getting the
      HKEY_CLASSES_ROOT\http\shell\open\command
key, which for me is set to
      C:\PROGRA~1\MOZILLA.ORG\MOZILLA\MOZILLA.EXE -url "%1"

When I execute the above command, I get a new browser each time!

However, I'm not sure how we can get the registry key while
using Sun's JVM. The code example uses classes from com.ms.*.
We could probably overcome this, perhaps by using a small
native function.  

The following was also useful:
http://forum.java.sun.com/thread.jsp?thread=28192&forum=17&message=69226

There is a GPL'd implementation at
http://ostermiller.org/utils/Browser.html
that looks interesting and might meet our needs.  However, because
it is GPL'd, I'd rather not include it in the core part of Ptolemy.

I'll poke around at this somemore at some point.

-Christopher

--------
    
    This was actually written quite some time ago when I encountered some
    problems using the BrowserLauncher. I was just reorganizing the repository
    to avoid code duplication (in Kepler).
    
    The BrowserLauncher class displays all URLs in the same browser window. I
    need to display several URLs in different windows during the workflow
    execution. Is it possible to extend this class to fit these needs?
    
    Thanks,
    
    Efrat
    
    ----- Original Message ----- 
    From: "Christopher Hylands Brooks" <cxh at eecs.berkeley.edu>
    To: "Efrat Jaeger" <jaeger at ecoinformatics.org>
    Cc: <kepler-dev at ecoinformatics.org>
    Sent: Monday, February 09, 2004 10:21 AM
    Subject: kepler/src/util/Browser.java
    
    
    > I noticed a cvs log message for kepler/src/util/Browser.java
    >
    > Just in case you do not know, Ptolemy II has a Browser invoker at
    > ptII/ptolemy/actor/gui/BrowserLauncher.java
    >
    > You can find the source code online at
    >
    http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII3.0/ptII/ptolemy/actor/gui/B
   rowserLauncher.java
    >
    > The Javadoc is at
    >
    http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII3.0/ptII/doc/codeDoc/ptolemy
   /actor/gui/BrowserLauncher.html
    >
    > See also
    > http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
    >
    > I'm not sure if the BrowserLauncher would meet your needs.
    > BrowserLauncher does try to support MacOS.
    >
    > If need be, we could further abstract the code so that you could use
    > it.
    >
    > -Christopher
    >
--------



More information about the Kepler-dev mailing list