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.

Member Avatar for iamthwee

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?

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!

Member Avatar for iamthwee

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?

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.

Member Avatar for iamthwee
/*
   * 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...

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.

Member Avatar for iamthwee

Oopsie, I gotta go now.

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!

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).

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.