p***p 发帖数: 559 | |
g*****g 发帖数: 34805 | 2 Runtime.getRuntime.exec()
firefox http://www.google.com.
【在 p***p 的大作中提到】 : IE或者FF,而且打开一个指定地链接
|
p***p 发帖数: 559 | 3
Runtime.getRuntime().exec(
"C:\.......\iexploer.exe");
对不对,请问如何指定路径呢
【在 g*****g 的大作中提到】 : Runtime.getRuntime.exec() : firefox http://www.google.com.
|
g*****g 发帖数: 34805 | 4 Just put the absolute path in it, you need to use "\\" to represent "\"
in a string. In a more robust approach you may want to read registry.
Either way, you lose the platform-independcy.
【在 p***p 的大作中提到】 : : Runtime.getRuntime().exec( : "C:\.......\iexploer.exe"); : 对不对,请问如何指定路径呢
|
s*******d 发帖数: 4135 | 5 建议只写iexplorer.exe,因为通常情况下ie是放在系统路径里的.
【在 g*****g 的大作中提到】 : Just put the absolute path in it, you need to use "\\" to represent "\" : in a string. In a more robust approach you may want to read registry. : Either way, you lose the platform-independcy.
|
s****e 发帖数: 113 | 6 建议你看看BrowserLaunch的源代码.用google搜一搜就可以搜到了
基本上在几个os上都可以调用缺省的browser
在windows下当然是ie或者firefox(反正是你设定的缺省的browser)
在linux下好像要指定名字,比如说mozilla.
在mac os下我没试过
【在 s*******d 的大作中提到】 : 建议只写iexplorer.exe,因为通常情况下ie是放在系统路径里的.
|
p***p 发帖数: 559 | 7
是在Eclipse里面用运行的,用ANT编译。请问是不是要选择run-windows?
try {
Runtime.getRuntime().exec("iexplorer.exe "+httpURI);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
错误信息如下
[java] java.io.IOException: CreateProcess: iexplorer.exe
http://localhost:8080/CallCenter/CustomerSipSelect;ApplicationSessionID=111160
931956213782591?employeeID=5&kundensip=sip:p***[email protected] error=2
[java] at java.lang.Win32Process.create(Native Method)
[java] at
【在 s*******d 的大作中提到】 : 建议只写iexplorer.exe,因为通常情况下ie是放在系统路径里的.
|
m******t 发帖数: 2416 | 8
It's "iexplore.exe" without the 'r'. And it's not by default on
the system path. People(the normal, innocent, ignorant, and
ever-demanding End Users, that is) don't start IE by typing it on
the command line, so it doesn't need to be on the path.
【在 p***p 的大作中提到】 : : 是在Eclipse里面用运行的,用ANT编译。请问是不是要选择run-windows? : try { : Runtime.getRuntime().exec("iexplorer.exe "+httpURI); : } catch (IOException e) { : // TODO Auto-generated catch block : e.printStackTrace(); : } : 错误信息如下 : [java] java.io.IOException: CreateProcess: iexplorer.exe
|
g*****g 发帖数: 34805 | 9 yep, it's better to use the default path, and throw an error
ask user to specify if you can' find it.
Or read registry.
【在 m******t 的大作中提到】 : : It's "iexplore.exe" without the 'r'. And it's not by default on : the system path. People(the normal, innocent, ignorant, and : ever-demanding End Users, that is) don't start IE by typing it on : the command line, so it doesn't need to be on the path.
|
w***f 发帖数: 75 | 10 还是用现成的吧, 考虑更周全些。
http://ostermiller.org/utils/Browser.java.html
【在 m******t 的大作中提到】 : : It's "iexplore.exe" without the 'r'. And it's not by default on : the system path. People(the normal, innocent, ignorant, and : ever-demanding End Users, that is) don't start IE by typing it on : the command line, so it doesn't need to be on the path.
|
|
|
p***p 发帖数: 559 | 11 多谢了,DEMO时候出了小丑。本来用IE工作,弹出的
窗口却是FF的,当时就笑场了
Runtime.getRuntime().exec("iexplorer.exe "+httpURI);
【在 w***f 的大作中提到】 : 还是用现成的吧, 考虑更周全些。 : http://ostermiller.org/utils/Browser.java.html
|
e***e 发帖数: 351 | 12 hehe
【在 p***p 的大作中提到】 : 多谢了,DEMO时候出了小丑。本来用IE工作,弹出的 : 窗口却是FF的,当时就笑场了 : : Runtime.getRuntime().exec("iexplorer.exe "+httpURI);
|
m******t 发帖数: 2416 | 13
Your application _is_ supposed to use whatever the user sets
her default browser to. You should feel good about it.
【在 p***p 的大作中提到】 : 多谢了,DEMO时候出了小丑。本来用IE工作,弹出的 : 窗口却是FF的,当时就笑场了 : : Runtime.getRuntime().exec("iexplorer.exe "+httpURI);
|
p***p 发帖数: 559 | 14 请问能不能启动一个浏览器之后能获得一个浏览器的对象,然后
可以操纵这个浏览器访问指定的连接?!
Runtime.getRuntime().exec("iexplorer.exe "+httpURI);
【在 g*****g 的大作中提到】 : yep, it's better to use the default path, and throw an error : ask user to specify if you can' find it. : Or read registry.
|
R*******r 发帖数: 104 | 15 Most browser would accept command line parameter, you can
call from there.
【在 p***p 的大作中提到】 : 请问能不能启动一个浏览器之后能获得一个浏览器的对象,然后 : 可以操纵这个浏览器访问指定的连接?! : : Runtime.getRuntime().exec("iexplorer.exe "+httpURI);
|
r*****e 发帖数: 23 | 16 去sourceforge找一个browserlauncher.
【在 p***p 的大作中提到】 : IE或者FF,而且打开一个指定地链接
|
b*****o 发帖数: 284 | 17 String[] command ={"cmd.exe","/c","C:\\Program Files\\Internet Explorer\\IEXPL
ORE.EXE","","" };
Process proc = Runtime.getRuntime().exec(command);
proc.waitFor();
【在 r*****e 的大作中提到】 : 去sourceforge找一个browserlauncher.
|
p***p 发帖数: 559 | 18 It works fine for me, I use following code to open a default Browser.
For windows:
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
It open a new Browser Process for every URL, have to shut down one by one. Now
After opening a browser, the following urls will be launched in the same
browser.
So first:
public static Process launchURL(Process p, String url)
if (p==null) {
p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " +
url);
} else {
?
【在 b*****o 的大作中提到】 : String[] command ={"cmd.exe","/c","C:\\Program Files\\Internet Explorer\\IEXPL : ORE.EXE","","" }; : Process proc = Runtime.getRuntime().exec(command); : proc.waitFor();
|