Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to invoke IE

Status
Not open for further replies.

LovelyAngel

Programmer
Mar 17, 2002
17
0
0
GB
Hi all,

I am working on a java application and I want it to invoke the IE to show the specific web page such hotmail.com. Can anyone tell me what to do.
Thank you.

Angel
 
There are a couple of way to do this:

Code:
Runtime.getRuntime().exec("cmd /c start [URL unfurl="true"]www.hotmail.com");[/URL]
Runtime.getRuntime().exec("start [URL unfurl="true"]http://www.hotmail.com/");[/URL]
Runtime.getRuntime.exec("IEXPLORE [URL unfurl="true"]http://www.hotmail.com");[/URL]
Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler [URL unfurl="true"]www.hotmail.com"[/URL] );

*** here is an Example w/code ***
Code:
import java.io.IOException;

public class StartIEFromJavaExample
{
	public static void main(String[] args)
	{
		String newLine 	= System.getProperty("line.separator");
		try
		{
			Runtime.getRuntime().exec("start [URL unfurl="true"]http://www.google.com/");[/URL]
			System.out.println ("Started IE from Java");
		}
		catch (IOException ioe)
		{
			System.out.println("The was a problem starting IE:" + newLine + ioe);
		}
	}
}

Hope this help you...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top