15

I just downloaded Netbeans because I read another question saying it's a good IDE to develop Javascript with. I tried making a new project, but there is no option to set it to Javascript.

If anyone knows how to set it up to develop with Javascript, please leave a reply. I will be much appreciative.

Thanks.

Shannon Rothe
  • 1,112
  • 5
  • 15
  • 26

8 Answers8

11

Update:

NetBeans 7.4 Released in October 2013, builds on the functionality listed below. As well as direct download of most major JS source files from CDNJS. Version 7.4 includes "Editing support for AngularJS, Knockout and ExtJS frameworks, Navigator and code folding in JSON files, Enhanced code completion with improved accuracy" see more here: https://netbeans.org/community/releases/74/

To set up a new JS project: under the File Menu choose -> New Project.

Step 1: Select HTML5 in categories and HTML5 Application in Projects Step 1: select HTML5 in categories and HTML5 Application in Projects

Step 2: Name your application. Step 2: name your application

Step 3: Choose a site template. Step 3: choose a site template

Step 4: Search for available libraries, click on the Version number to download previous versions. Step 4: Search for available JS libraries in 'Available'

Finish and you are done.

NetBeans 7.3 (scheduled for release in February 2013) introduces a new project type optimized for developing client web applications. This new project type can be found in New Project wizard in "HTML/JavaScript" category. HTML project supports is enabled by default for PHP and Java bundles of NetBeans, for other ones it need to be downloaded as a plugin.

see: http://wiki.netbeans.org/NetBeans_73_NewAndNoteworthy#Project_Creation


Original answer:

File> New Project> PHP > PHP Web Application .. Sounds like crap, but works fine. Because NetBeans doesn't have Javascript or HTML projects yet (in 7.0.1).

Tony Cronin
  • 1,623
  • 1
  • 24
  • 30
c69
  • 19,951
  • 7
  • 52
  • 82
  • 1
    This is a great workaround, indeed, creating a PHP Web Application give us the opportunity to just download "Netbeans for PHP" :) – Santi Agüero Aug 07 '12 at 18:15
  • I have been doing this for ages (well since PHP projects were added). Would really like to have a HTML / HTML5 or similar project type added. But it really doesn't make a lot of difference in daily life. – Fini Sep 04 '12 at 15:17
  • Is NetBeans able to automatically highlight syntax errors in JavaScript code, and does it have any autocompletion support for JavaScript? – Anderson Green Jan 11 '13 at 17:58
  • See here to enable PHP projects as an option in NetBeans: http://stackoverflow.com/questions/10473109/how-to-enable-php-support-in-netbeans – Anderson Green Jan 11 '13 at 18:09
3

[Note: this is for Netbeans 7.3+]

In NetBeans, a PHP project is a pretty general web application that can contain JavaScript, HTML, PHP, CSS, XML, and all the different web & server technologies (except Java) the Netbeans supports. So you can use a PHP aapplication as a general web project. This option is better than an HTML5 project because it includes server-side processing in the form of PHP files. Also, if you are developing in JavaScript, you will probably be using Ajax at some point, and PHP is a good language for the server side of Ajax, as well as server-side processing in general.

Instructions

Create a PHP Project.

  1. Go to the File menu.
  2. Click New Project.
  3. Select PHP in Categories.
  4. Select PHP Application.
  5. Click Next
  6. Fill out the details.(Name, location, server, etc. This part is pretty self explanatory.) (Note: if you need help, click the Help button in the lower right corner)

If you do not have the PHPOption in the New Project Dialog, then you did not install the PHP NetBeans plugin.

Installing the PHP Plugin:

  1. Go to the Tools menu.
  2. Click on the Plugins option. (It is second from the bottom)
  3. Click on the Available Plugins Tab.
  4. Search PHP.
  5. Check the checkbox next to the PHP Plugin..
  6. Click Install. (Lower-left corner)
  7. Click Next on the dialog that comes up.
  8. Click the I accept checkbox.
  9. Click the Install button.
  10. If a little window pops up in the lower right corner that says restart IDE, Exit Netbeans, and then Open it again. It may take longer than usual because it is installing the new Features.

To make JavaScript Files:

  1. Go to the File menu.
  2. Click New File.
  3. [Select the relevant category]

    A. (Netbeans 8.x) click HTML5 in Category.
    B. (Netbeans 7.x) click Other in Category.

  4. Select JavaScript File.
  5. Fill out the details. (Name, location,etc.)
Lux
  • 1,540
  • 1
  • 22
  • 28
3

NetBeans do support development of JavaScript. But, the Javascript files should have a web project container. Hence, first create a Web Application project by going to File> New Project> Java Web> Web Application. Continue and create a project. Once the project is created, expand the project to view Web Pages folder. Right click on the folder and select New > Other. Choose Other in Categories and then select JavaScript File. Start developing.

James Jithin
  • 10,183
  • 5
  • 36
  • 51
  • If you are not going to use Java, then PHP would be a more lightweight way to go, since you don't need to load / activate any Java features. – Fini Sep 04 '12 at 15:19
1

To force NetBeans to check JavaScript within PHP files, follow these instructions.

Go to Tools > Options > Miscellaneous > Files. From drop down menu File Extension select php5. From drop down menu Associated File Type (MIME) select text/javascript

Wachaga Mwaura
  • 3,310
  • 3
  • 28
  • 31
0

Check out this brand new plugin (I have not yet tested it)

NBWebProjectType - Generic projecttype for websites in NetBeans

Fini
  • 86
  • 3
0

the NetBeans PHP version should have those project templates.

... while one can still add further language support via plugins.

teamed up with Chrome/Chromium (NetBeans Connector) it's optimal for web development.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
0

do this:

  • Choose File --> New Project to open the New Project wizard.
  • Select HTML5/JS Application in the HTML/JavaScript category. and then continue with the ush.
0

click new file > [Categories] others > Javascript file

Netorica
  • 18,523
  • 17
  • 73
  • 108