Ikool’s Blogbed

Comparison of Javascript Supports in Netbeans and Eclipse

Have you ever tried to find a good javascript editor with code assistance? I was looking for a good HTML & javascript IDE/editor for long time, I haven’t find one till recently. Couple of years ago I used Netbeans to format HTML pages so that I can easily find out how HTML tags are matched, this can be very useful when you need just to figure out how some of the nice web page blocks are made. I am sure now some of you can easily get this information using firebug add-on in Firefox. But if you are still trying to find the matching HTML tags from HTML code, then you probably still have the same headache. However, the good news is Netbeans’ HTML editor is very helpful on this, you can easily format your HTML pages with a few key strikes using Netbeans IDE. In this article I’d like to focus on the difference of Javascript supports between Netbeans (6.5) and Eclipse 3.4.

Basically Eclipse’s JSDT (Javascript Development Toolkit) is not ready for any good use, I only gave it a few trys and then gave up. Here are the causes:

  1. It complains about javascript global variables such as document, window, navigator from javascript code/functions
  2. It complains “Can’t make a static reference to the non-static function” when you define a variable of javascript classes and try to access their member functions.
  3. It also complains when using alert function. I guess it will complain when you use other built-in functions
  4. It doesn’t quite support code completion as claimed
  5. I didn’t even try to try the debugging features because of above issues

For comparison, I installed Netbeans IDE and am using the latest Dev build, I didn’t try Netbeans 6.1 release because I will have to install PHP plugin to have good support of javascript, plus I also read NetBeans 6.5 (Milestones) has good support of it. Based on what I see, support of javascript in Netbeans 6.5 is much better than Eclipse although it also has its own issues. for example, one drawback is it currently only supports firefox, another is to make it work you have to install both firefox NetBeans extension and firebug add-ons. But Netbeans works fine regarding the above Eclipse issues:

  1. It works perfectly with javascript global variables such as document, window, navigator.
  2. It really works when defining a variable of javascript classes and trying to access their member functions.
  3. Code completion works without any issues, plus it’s very quick on popping up the suggestions
  4. Javascript collection objects (such as document.forms) work fine
  5. It supports both local and URL debugging. I did’nt try it though

For a complete list of features and details of Netbean support of javascript, please refer to JavaScript Debugger NetBeans 6.5 M1 User Guide

Finally, both Netbeans and Eclipse support code format, so reading javascript code is getting easier with both. Otherwise, you will have to use other tools to accomplish this type of tasks.

As of this writing, Netbeans is the best IDE that I’ve used for Javascript programming so far. I hope it will also help many others too.

Happy javascript coding with Netbeans IDE

Settings: Netbeans Dev (Build 200807040005), Eclipse 3.4 (Ganymemde) Java EE version

Advertisements

July 6, 2008 - Posted by | IDE Tools, Opinions, Technology | , , , , , ,

10 Comments »

  1. Please note that there is the great Aptana plugin for eclipse. So your comparison isn’t very meaningful without testing Aptana. Maybe you can repeat your comparison, cause there some points that sucks in eclipse, especially the speed in large projects.

    Comment by Andreas | July 7, 2008 | Reply

  2. Have you seen Aptana? It is the best eclipse-based js ide that I know of, and would probably make for a more interesting comparison to NetBeans.

    Comment by Gabe | July 11, 2008 | Reply

  3. Andreas and Gabe, thanks for your comments. I did use Aptana about a year ago, somehow I uninstalled it from my machine, I can’t really recall what’s the cause of it.
    I am trying to compare Netbeans and Eclipse’s own support of Javascript. I love Eclipse and use it everyday, but in this aspect, Netbeans does a good job, it also does a very good job on AWT/Swing UI design.
    the purpose of this blog is put what I experienced so that this will benefit others. I was trying Eclipse-PDT with great hope, but you know what happened.
    I wish Eclipse will put more effort on it then PDT will become a great tools for PHP community. ๐Ÿ™‚

    Comment by ikool | July 11, 2008 | Reply

  4. hi andreas,

    i’m guessing you were working on “standalone javascript” in jsdt.

    jsdt tries to be as true to to javascript as possible. the downfall of that is many of the browser javascript elements aren’t enabled by default and take a little extra configuration.

    two ways to solve this- when creating a new javascript project, there’s an “Enable Web Based JavaScript Support” check box. This will do appropriate setup so that the Window objects fields are visible. (window.document, window.alert(), window.window). The window.navigator object is a Mozilla specific field. You can get this by adding the FireFox support library in the projects JavaScript properties page.

    the other option is to create a web based or dynamic web based project. then the browser/window types and fields will be visible.

    -brad

    Comment by brad childs | July 30, 2008 | Reply

  5. sorry my comment was aimed at ikool’s blog, not andreas ๐Ÿ™‚

    Comment by brad childs | July 30, 2008 | Reply

  6. Thanks for sharing with us.

    But for javascript, you really should try Aptana, because it’s small and quicker.

    And for php, Zend studio (5.5 can be bought with around $100 from some online vendors) is far better than PDT. It’s reasonable, because ZEND is the main contributor for PDT. It’s not realistic to expect their free version beats their commercial version.

    Comment by Ming Zhu | August 28, 2008 | Reply

  7. I’d have to agree with the earlier posters.
    Eclipse is only a “holder” for plug-ins, and the Aptana plug-in for Eclipse is the best I’ve ever used. Aptana can be added to an existing installed Eclipse or as an Eclipse-based stand-alone.
    Also, Aptana provides more than just Javascript support; it’s HTML support is excellent, and Aptana itself can be augmented with plug-ins for Ruby On Rails and Python amongst other things.
    The (almost) crowing glory with Aptana is that it has a reasonably good plug-in for PHP. This plug-in does not yet provide as good a level of PHP support as the Eclipse PDT, but it’s getting better; in about a year, I reckon, I’ll be able to remove PDT from my Eclipse, and edit my PHP pages (ie PHP, HTML, JavaScript) all from the one editor.
    I like Aptana, can you tell ?

    Comment by Simon | November 20, 2008 | Reply

  8. Well, if people would realize what the blogger is saying.

    He is trying to compare native support for these things. There are some Eclipse projects that are part of the standard distribution and from the Eclipse repositories.

    Eclipse is great at Java out of the box, and with those plugins, but it is horrible for Enterprise Java development, and developing with some dynamic and scripting languages. JavaScript support is bad now.

    Aptana is an Eclipse plug-in that used to be commercial, IIRC. It is not without its problems, and while it is much better than the Eclipse PSDT, I am not sure what the status of its development is, since I’ve been using NetBeans since the 6.0 version.

    I think it’s 2008 and Eclipse hype has died down a bit. It is falling behind more and more comparative to its competition.

    Comment by NB User | December 5, 2008 | Reply

  9. Also, it is pretty bad to have to go on a treasure hunt to get pretty standard functionality from an IDE. NetBeans has a godly out of the box experience compared to Eclipse. DB support and Scripting/Dynamic Languages support is first rate as of late.

    Eclipse seems to have slowed down considerably in factorable improvements as its hype has died down.

    Comment by NB User | December 5, 2008 | Reply

  10. Poster #4 mentions two ways to solve the Javascript validation problems in Eclipse.

    I also tried a third one which didn’t work too well:

    Create a fresh new “Web Javascript Project”.
    Then copy any missing entries in .project and .settings (two hidden files inside each project) from the new project to your project, and refresh.

    It almost works but there are some strange errors.

    Comment by Alex | April 18, 2009 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: