有没有办法防止 Eclipse 在启动 Web 应用程序时打开浏览器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5041975/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a way to prevent Eclipse from opening the browser when starting a Web application?
提问by bluefoot
Ahoy!
哎呀!
I was wondering if there's a way to configure eclipse not to open the browser (internal or external, doesn't matter) when the user selects Run As > Run or server in a specific (or any) web project.
我想知道当用户在特定(或任何)Web 项目中选择 Run As > Run or server 时,是否有一种方法可以配置 eclipse 不打开浏览器(内部或外部,无关紧要)。
Couldn't find that option...
找不到那个选项...
采纳答案by Eduard
No there is not. The way to do this is not click on the apllication and run as, but to click on your server and launch it(and deploy your application). Then you will get rid of browser opening.
不,那里没有。这样做的方法不是点击应用程序并运行,而是点击您的服务器并启动它(并部署您的应用程序)。然后你将摆脱浏览器打开。
回答by Jonathan Barber
On Eclipse Juno through Oxygen, change the preferences (Window->Preferences->General->Web Browser) to add a new external web browser and set it's location as "/bin/true
" (under UNIX), "/usr/bin/true
" (under Mac OS Yosemite through Mojave), or "C:\Windows\System32\cmd.exe
" with parameter "/c
" (under Windows). Then set this as the default browser.
在 Eclipse Juno 上通过 Oxygen,更改首选项(Window->Preferences->General->Web Browser)以添加新的外部 Web 浏览器并将其位置设置为“ /bin/true
”(在 UNIX 下)、“ /usr/bin/true
”(在 Mac OS Yosemite 下通过 Mojave ),或C:\Windows\System32\cmd.exe
带有参数“ /c
”的“ ”(在 Windows 下)。然后将其设置为默认浏览器。
After this, whenever you "Run on server", Eclipse will spawn this command (which immediately succeeds) instead of touching your browser.
此后,每当您“在服务器上运行”时,Eclipse 都会生成此命令(立即成功),而不是触摸您的浏览器。
This isn't a per-project setting though.
但这不是每个项目的设置。
回答by fmucar
If you run the server from the server view it won't open the browser.
如果您从服务器视图运行服务器,它不会打开浏览器。
回答by Rahul Gupta
You should try this:
你应该试试这个:
In MyEclipse, change the preferences (Window->Preferences->General->Web Browser) check radio button (use external web browser) and click on new to add a new external web browser and set it's location of your browser and enter name (as your choice), then click on ok.
在 MyEclipse 中,更改首选项(Window->Preferences->General->Web Browser)检查单选按钮(使用外部 Web 浏览器)并单击 new 添加一个新的外部 Web 浏览器并设置它的浏览器位置并输入名称(作为您的选择),然后单击确定。
回答by SaganTheBest
I was wondering the same question
我想知道同样的问题
Instead of clicking the run button
而不是点击运行按钮
try press Relaunch
尝试按重新启动
(I'm on STS)
(我在 STS 上)
回答by Revive
Just fixed this issue for me. You should do the following: Create a file null.bat that contains something like "@echo off". It doesn't really matter where you put it.
刚刚为我解决了这个问题。您应该执行以下操作: 创建一个包含“@echo off”之类的内容的文件 null.bat。你把它放在哪里并不重要。
Go to Eclipse=>Preferences=>General=>Web Browser, check "Use external web browser". Create a new external Web broswer. Name it something and point the Location to where you stored your null.bat
转到 Eclipse=>Preferences=>General=>Web Browser,选中“使用外部 Web 浏览器”。创建一个新的外部 Web 浏览器。将其命名并将位置指向您存储 null.bat 的位置
That way Eclipse runs your null.bat and does nothing :)
这样 Eclipse 运行您的 null.bat 并且什么都不做:)