My Java Swing application generates an HTML file, and I want to open it with the default browser when it is generated and saved. How can I do this?
Runtime rTime = Runtime. getRuntime(); String url = "D:/hi. html"; String browser = "C:/Program Files/Internet Explorer/iexplore.exe "; Process pc = rTime.
If you are using Java 6, use Desktop.open(). It allows you to open any file with the default application associated with its file type on the system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With