# how to link html files to java program



## umar_bin_rashid (Aug 2, 2006)

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.


----------



## Pathik (Aug 2, 2006)

do u wanna give a dload link or u wanna display the contents of that on screen....


----------



## umar_bin_rashid (Aug 2, 2006)

pathiks said:
			
		

> do u wanna give a dload link or u wanna display the contents of that on screen....


i want to display the contents of that on screen.


----------



## sakumar79 (Aug 2, 2006)

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


----------



## umar_bin_rashid (Aug 2, 2006)

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 (Aug 3, 2006)

umar_bin_rashid said:
			
		

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




```
Process process;
process = Runtime.getRuntime().exec("<any command you want>");
```


----------



## sakumar79 (Aug 3, 2006)

^^ But in this process, you will drop the OS-independence of the program.

Arun


----------



## aadipa (Aug 3, 2006)

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 (Aug 4, 2006)

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 (Aug 5, 2006)

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.


----------



## umar_bin_rashid (Aug 5, 2006)

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


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 (Aug 5, 2006)

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 )


----------

