views:

30

answers:

2

I have experience using Netbeans with Java but am new to using it with Javascript. I know how to open javascript files within a Java Project but is there a way to open javascript in a "javascript project" where I might be able to "compile" the code and see possible errors. Is this possible or am I asking too much?

A: 

To check for code quality you can use some JavaScript analysis tools like JSLint.

http://www.jslint.com/

But it's not nearly as good as compilation in a fully typed language like Java.

An alternative is to not write the JavaScript at all but use Java instead and have it converted to JavaScript. This gives you the advantage of writing fully typed code that can be statically analyzed and checked for errors. Google's GWT does this and there are other similar options.

http://www.artima.com/lejava/articles/java_to_javascript.html

Sam
+1  A: 

By compile, I'm assuming you mean simple validation (like using undefined variables or typos etc.)

I may be wrong, but netbeans has the worst javascript support. If you want simple validation of Javascript code, you may look at Eclipse javascript environment (or the Aptana plugin). IntelliJ IDEA has very decent validator as well.

Chetan Sastry
Thank you I will look into it and get back to you
Steve