I want to use Eclipse as my editor for HTML/Javascript files. When I "Run", I would like to see开发者_开发技巧 a browser (any one of Internet Explorer, Firefox, etc on Windows) launched for my file. How can I set up a 'run configuration' to do this?
You could set up an External Tool configuration that, when you run it, would open, in a browser, the document you're currently editing. Instead of "Run", you'd click the button next to the Run button, with the little red suitcase over it.
To set it up, use the menus: Run...External Tools...External Tools Configurations. You'll get a configuration dialog. Now:
- Give your config a Name (like "view in Firefox")
- Enter the full path to your browser in the Location field along with the executable name of the browser.
- Don't worry about the working directory
- Click the Variables button; in the dialog that pops up, look for the variable called "selected_resource_loc". Choose it and dismiss the popup dialog.
- And now hit "Apply" and dismiss the main dialog.
Running an External Tool Configuration is a lot like running a Launch Configuration: you can choose from the menus, or use the buttons on the button bar; if you click one of those buttons, it will run the last configuration you selected (on whatever document you're editing).
The important things to note are:
- you have to have the right path to the browser executable
- the arguments to the executable will be those in the Arguments text area, which is where the variable we chose ("selected_resource_loc") will appear; if you need more stuff on that command line, put it in the Arguments
- the "selected_resource_loc" is expanded at execution time to the full path of the currently-selected document
See these docs for more detail.
had the same problem, it's really annoying that there is no default behaviour of eclipse to deal with html files.
here is how i did it with pictures! ;)
http://dwaves.de/index.php/2014/01/16/eclipse-run-launch-html-htm-webpage-in-external-browser-external-tools-shortcut-hotkey/
You could install the WTP tools and set up a Static Web Project. Copy your files into that (or you may be able to set up a short cut, I'm not sure). You can change the browser in Preferences->General->Web Browser. Selecting Run with launch the browser and your content.
Eclipse has great refactoring, syntax checking and formatting now for JavaScript, I really recommend it.
I have installed aptana studio plugin for eclipse, and that will enable run as "java script web applicaiton" option.
Install aptana studio pluging as follows
- Open Eclipse
- Help -> Install New Software
- Add (on the top right)
- Enter the following link for Aptana Plugin with
- http://download.aptana.com/studio3/plugin/install
- Click OK
- Put a check mark for Aptana Studio 3
- finish
install wamp server if you dont have it http://www.wampserver.com/
Go to the Main Menu with in the Select --> window -> webbrowser --> Here by default "internal browser will selcted" if you want to change select --> chrome/firefox/ie then you can run the web application project and the result will be displayed in the web browser you selected.
精彩评论