日期:2014-05-16  浏览次数:20582 次

javascript IDE 学习笔记
最近学习javascript,开始寻找像开发java一样的IDE,发现eclipse有很多插件可以实现 js开发,其中aptana很不错,于是就在网上找资料不停的尝试。下面是本人整理的一些笔记,包括远程调试node.js插件。不多说了。专正题。

一, eclipse 安装nodejs远程调试工具:
nodejs是基于v8 javascript,v8提供了eclipse插件,eclipse所以通过安装v8插件可以实现对nodejs的调试。具体步骤如下所示。
1.help—install—workwith 选择add,
名字随便,地址http://chromedevtools.googlecode.com/svn/update/dev/  点击ok

选择如图所示,点击下一步,最后点击同意,完成安装。这个地方要选上面的那个,我选下面的那个安装老是报错。
1. nodejs调试。
新建helloword.js文件
var http= require('http');
http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
保存。
命令:node –debug-brk hello_word.js
以debug模式启动nodejs服务。
点  选择debugconfig 打开如下界面:

新建一个host:localhost 端口采用默认端口:5858,点击debug,就可以进行调试,
双击左侧可以添加断点。然后就可以进行调试了。


二, ecipse添加javascript开发换件
javascript编辑器可以说有很多,最简单的使用记事本也可以,但是找一个好的编辑器可以大大提高工作效率,达到事半功倍的效果。
Adapata是一个比较好的编辑器,具有强大的js调试功能,但是他的js调试基于firefox,所以想要使用adpata进行js调试必须先安装firefox,adpata有eclipse插件版本,下面介绍如何给eclipse添加adpata插件。
我们采用在线安装的方式:

1. 和安装v8插件一样,Eclipse 的 Help 菜单中,选择 Software Updates->Find and Install...,这会打开 Install/Update 弹出窗口。
a. 在 Install/Update 弹出窗口中,选择 Search for new features to install 选项并单击 Next。
b. 为了设置新的远程更新站点,单击 New Remote Site... 按钮,这会打开 New Update Site 弹出窗口。
c. 在 New Update Site 弹出窗口中,在 Site Name 文本框中输入 Aptana。
d. 在 URL 文本框中,输入 Aptana 更新站点的 URL:http://download.aptana.com/tools/studio/plugin/install/studio
注意去掉Group items by category 和 Contact all update sites during install to find required software 两项.并单击 OK
e. 安装完成之后就可以在windows-open prespective 找到
打开aptana视图。就可以随心所欲的开发js了。功能很强大的。



Aptana 3

http://aptana.com/downloads/start

Installing via Eclipse

Please copy the following Update Site URL to your clipboard and then follow the steps listed below to add this URL to your

Available Software Sites list. Attempting to access this URL using your web browser will return an Access Denied error.

http://download.aptana.com/studio3/plugin/install

1 From the Help menu, select Install New Software... to open the Install New Software dialog.

2 Paste the URL for the update site into the Work With text box, and hit the Enter (or Return) key.

3 In the populated table below, check the box next to the name of the plug-in, and then click the Next button.

4 Click the Next button to go to the license page.

5 Choose the option to accept the terms of the license agreement, and click the Finish button.

6 You may need to restart Eclipse to continue.


Prerequisites

Before you install the Beta Release, you need to have a working Java/Eclipse development environment. That means you

should have the following tools installed and working correctly:

· Sun (Oracle?) Java 1.6.x (so on Mac, you must be running OS X 10.5.8 or better on a 64 bit machine. You can download

JDK 1.6 for OS X 10.5 here.) OpenJDK is not supported.

· Git is required because it is used internally to update your scripting environment. On Windows, we recommend msysgit

because we also require its bash shell for executing commands. If you don't have msysgit installed, Studio 3 will offer to

install a local copy of msysgit's portable git variant for its own internal use.

· You must install into Eclipse 3.5 or 3.6.





Aptana 2

http://aptana.com/downloads/start

Installing via Eclipse

Please copy the following Update Site URL to your clipboard and then follow the steps listed below to add this URL to your