how to link html files to java program

Status
Not open for further replies.

umar_bin_rashid

Right off the assembly line
i have created project in java.now the problem is that i want to create html file for my project that contains some inf regarding my project.but i dont know the way to link this html file to my java program.
 

sakumar79

Technomancer
You will have to create a JPanel (remember vaguely about this...) with a JTextArea and JTextPane etc... Search for how to create a browser in Java - this will give you ideas of what to do...

Arun
 
Last edited:
OP
U

umar_bin_rashid

Right off the assembly line
sakumar79 said:
You will have to create a JPanel (remember vaguely about this...) with a JTextArea and JTextPane etc... Search for how to create a browser in Java - this will give you ideas of what to do...

Arun
that way i know but it is very time consuming.cant i call microsoft IE from my java program
 

aadipa

Padawan
umar_bin_rashid said:
that way i know but it is very time consuming.cant i call microsoft IE from my java program
Code:
Process process;
process = Runtime.getRuntime().exec("<any command you want>");
 

aadipa

Padawan
the request was for directly starting Microsoft IE so is the code.

Runtime.exec() is the method to call external program, and thus it will not be OS independant.

What you can do is to ask for path to browser file while starting the program and then call that browser in exec() call.

You can pass url as command line parameter in exec() call.
 

rohan

In the zone
i think he wants to create a browser view within the Java applet like a widget.... hmm... maybe there is a way for it... coz i hate java ;)
 

aadipa

Padawan
rohan said:
i think he wants to create a browser view within the Java applet like a widget.... hmm... maybe there is a way for it... coz i hate java ;)

In that case, try to use JEditorPane from swing library.
Look here for more info about how to do that.
 
OP
U

umar_bin_rashid

Right off the assembly line
aadipa said:
the request was for directly starting Microsoft IE so is the code.

Runtime.exec() is the method to call external program, and thus it will not be OS independant.

What you can do is to ask for path to browser file while starting the program and then call that browser in exec() call.

You can pass url as command line parameter in exec() call.
my actual problem is that-------
i have created one html file.
now i want to open that html file in web browser on click event of a button in java.
plz reply........
 

rohan

In the zone
do as he said: Runtime.exec(path to html filename)

also, don't forget to put it in the appropriate event... ;) btw.. this will open the html file in the default web browser on the system. Or maybe it opens it with a text editor(if ur user has set it up that way... web designers generally do that ;))
 
Status
Not open for further replies.
Top Bottom