Hi all.
Can anyone give me some pointers as to how to open a webpage in java. The
webpage is stored locally (eventually on a cd) and its the help file for the
java program. I cant seem to get the webpage to open and was wondering if
its possible at all.
Any ideas welcome
Thanks in advance
JS
Jan Peter Stotz - 23 Dec 2005 10:40 GMT
JS schrieb:
> Can anyone give me some pointers as to how to open a webpage in java. The
> webpage is stored locally (eventually on a cd) and its the help file for the
> java program. I cant seem to get the webpage to open and was wondering if
> its possible at all.
You want to open the webpage in the default browser, not in your java
application, right?
If yes, take a look at this SF-project
http://browserlauncher.sourceforge.net/
Jan
JS - 23 Dec 2005 10:52 GMT
Thanks, I can include IE on the cd so I'm not too worried about that, I'm
just stuck on how to open the html file itself. Ideally I would use
something similar to the Visual Basic syntax which basically calls a shell
with the application name (IE) and the name and path of the file. But I dont
think java can do that??
JS
> JS schrieb:
>
[quoted text clipped - 10 lines]
>
> Jan
Viator - 23 Dec 2005 11:16 GMT
Including a setup of IE on CD will not help you because you need to run
the setup before it can be run. I think IE must be installed on all the
Windows systems where your Java app is supposed to run because IE is
inbuilt in most Win ditros. If you want to use the exsting IE in the
target platform you need to know the path of that then you can open
your file bu using RunTime.exec()
PATH_TO_IE\IExplore.exe YOUR_FILE
Amit :-)
Viator - 23 Dec 2005 10:54 GMT
If you want your own component then you can use a third pary browser
compnent. One is available at
http://www.javio.com/webwindow/webwindow.html
Amit :-)
JS - 23 Dec 2005 11:06 GMT
I have a browser that can be run. I will include Internet Explorer with the
java app, I just need to know how to open my help file with the browser on
the cd. The browser will be stored in a folder called Apps and the help file
will be in a folder called Help. My java application will be in the
directory above these two folders.
> If you want your own component then you can use a third pary browser
> compnent. One is available at
> http://www.javio.com/webwindow/webwindow.html
>
> Amit :-)
Roedy Green - 23 Dec 2005 12:38 GMT
>Can anyone give me some pointers as to how to open a webpage in java. The
>webpage is stored locally (eventually on a cd) and its the help file for the
>java program. I cant seem to get the webpage to open and was wondering if
>its possible at all.
It is just a file. If you now its file name read it as a string chars.
See http://mindprod.com/applets/fileio.html for sample code.
if it is being served by a local webserver or application server, the
document will have a URL perhaps something like
http://localhost:81/xxxx/yyyy.html
Try it out with a browser to make sure you have the correct URL
then read it with a CGI-GET.
again see
http://mindprod.com/applets/fileio.html for sample code.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
David Segall - 23 Dec 2005 14:25 GMT
>Hi all.
>Can anyone give me some pointers as to how to open a webpage in java. The
[quoted text clipped - 4 lines]
>Thanks in advance
>JS
Assuming you just want to open your help file in a browser you can
launch the browser with something like:
Process proc = Runtime.getRuntime().exec("C:\Program Files\Internet
Explorer\iexplore.exe " + "helpfile.html");
Ideally, you should use the installed default browser but I have no
idea how you would do that in an operating system in dependant way.
Andrew Thompson - 26 Dec 2005 02:42 GMT
> Can anyone give me some pointers as to how to open a webpage in java.
There are a number of ways to display a web page
from within a Java application, the first, and possibly
easiest, is to put your HTML in a JEditorPane. A JEP
is unsuitable for 'real world' web pages, but chould be fine
for presenting basic information formatted as HTML.
You can see an example in 'The Giffer'* press F1 for the help file.
<http://www.physci.org/giffer/giffer0512.jnlp>
The second way, available to WebStart'ed applications, is to
use the WebStart equivalent of the applet 'showDocument'..
<http://www.physci.org/browserlauncher/jnlp/showdoc.jnlp>
A third way is to use a library like BrowserLauncher to
find the default browser and launch it..
<http://www.physci.org/browserlauncher/index.jsp>
HTH

Signature
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew