954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Can JMenuItem point to a HTML file that opens in IE?

Can JMenuItem point to a HTML file that opens in IE?

I want the jMenuItem (E.g: Tutorial Help) to point to tutorial.html on my computer.

Couldn't find any information about it at all on the net. Can any kind souls out there help me?

Your help is greatly appreciated.

Thank you.

blurstudent
Newbie Poster
14 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 
Can JMenuItem point to a HTML file that opens in IE? I want the jMenuItem (E.g: Tutorial Help) to point to tutorial.html on my computer. Couldn't find any information about it at all on the net. Can any kind souls out there help me? Your help is greatly appreciated. Thank you.

You mean, how can you open up a url from a java program?

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

erm. ya. sort off. But mine is an application. I just want the link to point to a HTML file. Can it be done?

Pardon me if it can't be done.

Thanks!

blurstudent
Newbie Poster
14 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 
erm. ya. sort off. But mine is an application. I just want the link to point to a HTML file. Can it be done? Pardon me if it can't be done. Thanks!

Oh i see, you mean like how can java execute an external process, such as notepad, or in your case a .html file?

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

yeah. I just want it to open in Internet Explorer in this case. :P You able to help me?

I'll be very much appreciated.

blurstudent
Newbie Poster
14 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 
/*
   * ped.java
   *
   * Created on 29 April 2006, 17:07
   */
import java.awt.*;
import java.io.*;
import java.util.*;


public class ped {
   public static void main(String[] args) throws Exception {
     try
{
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("notepad.exe");
}

catch(Exception e)
{

}
     }
   }


That opens notepad, although I'm not sure how to open explorer? But I reckon it's pretty close...

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

hey, thanks for that part! I managed to open up the IE. But the problem here is, I do not know how to get it to point to the URL "tutorial.html"

Sorry about that.

blurstudent
Newbie Poster
14 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

Oopsie, I gotta go now.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

hey! No worries! I got it settled!

Runtime rt = Runtime.getRuntime();
Process p = rt.exec("C:/Program Files/Internet Explorer/iexplore.exe www.yahoo.com.sg");

and it works! wohoo!

Thanks alot!

blurstudent
Newbie Poster
14 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

But why do it like that?
Why not embed a web browser control in a Java window?
If simple HTML 3.0 is enough you can use standard controls for that, else you might have to find something on the web (or get creative and write your own HTML parser).

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 
But why do it like that? Why not embed a web browser control in a Java window? If simple HTML 3.0 is enough you can use standard controls for that, else you might have to find something on the web (or get creative and write your own HTML parser).



haha. nah. too much time involved. thks for your suggestion anyway.

blurstudent
Newbie Poster
14 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

Sorry

blurstudent
Newbie Poster
14 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You