Hi
Need a bit of help here please to point me in the right direction.
I have a java class file here which i wish from a menu item to open a web page which contains a help page. - ]
-
} else if (arg.equals(" Help Page")) {
-
} else if (arg.equals("BrowserControl")) {
-
parent.doconnect();
-
Below is the java file that calls the web page this works fine for some reason I can’t call it from the previous java class file
Many thanks for any help
Keith -
import java.io.IOException;
-
/**
-
* A simple, static class to display a URL in the system browser. *
-
* Under Unix, the system browser is hard-coded to be 'netscape'.
-
* Netscape must be in your PATH for this to work. This has been
-
* tested with the following platforms: AIX, HP-UX and Solaris. *
-
* Under Windows, this will bring up the default browser under windows,
-
* usually either Netscape or Microsoft IE. The default browser is
-
* determined by the OS. This has been tested under Windows 95/98/NT. *
-
* Examples:
-
* Note - you must include the url type -- either "http://" or
-
* "file://".
-
*/
-
public class BrowserControl
-
{
-
/**
-
* Display a file in the system browser. If you want to display a
-
* file, you must include the absolute path name.
-
*
-
* @param url the file's url (the url must start with either "http://"
-
or
-
* "file://").
-
*/
-
public static void displayURL(String url)
-
{
-
boolean windows = isWindowsPlatform();
-
String cmd = null;
-
try
-
{
-
if (windows)
-
{
-
// cmd = 'rundll32 url.dll,FileProtocolHandler http://...'
-
cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
-
Process p = Runtime.getRuntime().exec(cmd);
-
}
-
else
-
{
-
// Under Unix, Netscape has to be running for the "-remote"
-
// command to work. So, we try sending the command and
-
// check for an exit value. If the exit command is 0,
-
// it worked, otherwise we need to start the browser.
-
// cmd = 'netscape -remote openURL(http://www.javaworld.com)'
-
cmd = UNIX_PATH + " " + UNIX_FLAG + "(" + url + ")";
-
Process p = Runtime.getRuntime().exec(cmd);
-
try
-
{
-
// wait for exit code -- if it's 0, command worked,
-
// otherwise we need to start the browser up.
-
int exitCode = p.waitFor();
-
if (exitCode != 0)
-
{
-
// Command failed, start up the browser
-
// cmd = 'netscape http://www.javaworld.com'
-
cmd = UNIX_PATH + " " + url;
-
p = Runtime.getRuntime().exec(cmd);
-
}
-
}
-
catch(InterruptedException x)
-
{
-
System.err.println("Error bringing up browser, cmd='" +
-
cmd + "'");
-
System.err.println("Caught: " + x);
-
}
-
}
-
}
-
catch(IOException x)
-
{
-
// couldn't exec browser
-
System.err.println("Could not invoke browser, command=" + cmd);
-
System.err.println("Caught: " + x);
-
}
-
}
-
/**
-
* Try to determine whether this application is running under Windows
-
* or some other platform by examing the "os.name" property.
-
*
-
* @return true if this application is running under a Windows OS
-
*/
-
public static boolean isWindowsPlatform()
-
{
-
String os = System.getProperty("os.name");
-
if ( os != null && os.startsWith(WIN_ID))
-
return true;
-
else
-
return false;
-
}
-
/**
-
* Simple example.
-
*/
-
public static void main(String[] args)
-
{
-
displayURL("http://www.javaworld.com");
-
}
-
// Used to identify the windows platform.
-
private static final String WIN_ID = "Windows";
-
// The default system browser under windows.
-
private static final String WIN_PATH = "rundll32";
-
// The flag to display a url.
-
private static final String WIN_FLAG = "url.dll,FileProtocolHandler";
-
// The default browser under unix.
-
private static final String UNIX_PATH = "netscape";
-
// The flag to display a url.
-
private static final String UNIX_FLAG = "-remote openURL";
-
}
4 1687 pbmods 5,821
Recognized Expert Expert
We'd love to help you, but you've posted this in the JavaScript forum.
I've notified a JavaScript moderator so we can get your post moved to a forum where it will receive more relevant exposure.
Hi
Many thanks sorry I have posted to the wrong forum
Keith
acoder 16,027
Recognized Expert Moderator MVP JosAH 11,448
Recognized Expert MVP
Maybe I totally misunderstood your question but have you ever read about Sun's
Java Help System? Here's the link.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: D. Alvarado |
last post by:
Hello,
I am trying to open a window containing an image and I would like
the image to be flush against the window -- i.e. have no padding or
border. Can I make this happen with a single call to a window.open
function? I would prefer not to create a separate HTML page. So far
all I have is the basic
var cwin = window.open('images/KJV-THANKS.gif',
'Thanks', 'width=243,height=420,');
cwin.focus();
|
by: yup |
last post by:
I was wondering if you know a way to have, let's say, you
would click on a menu bar item (where something like
file, edit, format, help options are on Microsoft Word)
and instead of opening a dialog box it would "switch" to
another page (within the program) and maintain the same
menu bar as before.
For example, in Quicken I would click on "Finances"
then "Account List" and a new page would open under the
existing menu bar. It wouldn't...
|
by: Martien van Wanrooij |
last post by:
I have been faced a couple of times with the situation that I wanted to
write a script and was worried about a too frequent opening and closing
mysql connections.
To give some examples:
1)I am trying to develop a photoalbum (also posted a topic called "array /
mysql question"). Of course I can use some wonderful open source albums but
at the same time I want to get more familiar with all the ins and outs so my
idea is a list of...
|
by: swapcool |
last post by:
Hi,
I am a page having a menu and a few frames life below.
The links in menu open in F3 frame. I also have back/forward buttons in F1 frame.
________________________
____________F1_________|
| F2 |................................ |
| .... |................................ |
| M | .............F3...............|
| E | ...............................|
|
by: timhaynes1985 |
last post by:
Hi, I am very new to PHP so please go easy on me.
I have a page with 2 divs next to each other, a menu in the left and
content in the right. Now what I want to know, is it possible to
chenge the file being included in the content div when I click on
different links in the menu div?
So basically, when I click on the 'News' link it includes the file
'news.php' in the content div and so on for the rest of the menu
items.
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |