In one of my java console application, I am dynamically creating html page. Now I want to open it using default web browser. So can you guys please help me out to solve it.
asked Jan 10, 2011 at 17:55
CrazyCoder
2,6319 gold badges38 silver badges62 bronze badges
-
You want your application to launch the browser, displaying your dynamically created HTML?dom farr– dom farr2011年01月10日 17:57:07 +00:00Commented Jan 10, 2011 at 17:57
3 Answers 3
Swing java.awt.Desktop.getDesktop().browse(uri);
SWT Program.launch(uri);
Taken from In Eclipse Plug-in, how to launch a web url using system broswer?
Assuming you have a file to open.
answered Jan 10, 2011 at 17:58
Favonius
14k4 gold badges58 silver badges95 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
With Java, your website is dynamic, so you need a server to run your web application. The most common one is Apache Tomcat. You should read about Tomcat if you plan to program websites with Java.
answered Jan 10, 2011 at 17:59
Jonathan Rioux
1,1264 gold badges15 silver badges31 bronze badges
1 Comment
dvhh
tomcat would be heavy for his task I'm sure that more lightweight servlet container exists for such task such as winstone en.wikipedia.org/wiki/Winstone_Servlet_Container or Jetty docs.codehaus.org/display/JETTY/Embedding+Jetty
lang-java