我尝试通过Java程序打开本地(在我的系统中)的HTML文件。 我尝试了一些在stackoverflow上找到的程序,但它们并没有像预期的那样运行。
例如: 我有一个小的HTML文件。
<html>
<head>
Test Application
</head>
<body>
This is test application
</body>
</html>
我的 Java 代码:
Runtime rTime = Runtime.getRuntime();
String url = "D:/hi.html";
String browser = "C:/Program Files/Internet Explorer/iexplore.exe ";
Process pc = rTime.exec(browser + url);
pc.waitFor();
非常感谢任何解决方案或建议。