|
Thanks Larry.
I got your point about the main but I thought there was already a main
in Browser() so didn't bother. I seem to have made a lot of progress
with another similar code. But now I am not able to open the browser
type.
The code is similar to Browser() called BrowseControl() and I removed
all the package declarations & jar to call from command line (I still
don't understand why it would find the class from jar when the classpath
refers to jar). I get browser not found or cannot be opened error now.
>From the code I understand it picks up UNIX_PATH and so I changed the
default since I don't have netscape.
Java Code:
// The default browser under unix.
// private static final String UNIX_PATH = "netscape";
// The flag to display a url.
private static final String UNIX_PATH = "explorer";
private static final String UNIX_FLAG = "-remote
openURL";
I also tried MSIE
Call and error:
Could not invoke browser, command=MISE -remote
openURL(http://www.javaworld.c
om)
Caught: java.io.IOException: MISE: not found
$
> java BrowseControl http://www.yahoo.com
Could not invoke browser, command=MISE -remote
openURL(http://www.javaworld.c
om)
Caught: java.io.IOException: MISE: not found
$
> java BrowseControl http://www.yahoo.com
Could not invoke browser, command=explorer -remote
openURL(http://www.javawor
ld.com)
Caught: java.io.IOException: explorer: not found
Thanks again,
Sudha
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
-----Original Message-----
From: Larry [mailto:Larry_Ducie@xxxxxxxxxxx]
Sent: Sunday, December 12, 2004 7:26 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: RPG - Java Call
Hi again Sudha,
Further to my last post:
1) Forget what I said about Ostermiller vs ostermiller. I see you can't
change this as you didn't create the jar file. (Just googled and found
the
jar file on the net.)
2) Having had a quick look at the javadoc, If you want to display a web
resource via the command line using this Browser class then you should
create your own class. I'd suggest something like:
import com.Ostermiller.util.Browser;
import java.io.*;
public class CallBrowser {
public static void main(String[] args) {
if (args[0] != null) {
try {
// Initialise the Browser class...
Browser.init();
// Display the passed web page...
Browser.displayURL(args[0]);
// Catch the exception thrown by Browser.displayURL(String s)...
} catch(IOException e) {
System.err.println("Browser went bang");
// Catch any other exceptions thrown within the try block...
} catch(Exception e) {
System.err.println("It ALL went bang");
} // end try...
} // end if...
} // end main...
} // end class...
I've just knocked this up quickly, so it would need tidying up (I'd
suggest
allowing for a second string element, so you can specify the window to
use).
However, I've just downloaded the Ostermiller jar file, compiled this
class
and got it to open the URL I passed from the command line. It opened
within
Internet Explorer. This was all done on my PC.
Cheers, and I hope this is of use.
Larry Ducie
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.