Compiling Javascript with Netbeans
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 j开发者_开发百科avascript 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?
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.
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
精彩评论