Building a Cordova mobile app with NetBeans

Here is a quick look at building a mobile app using NetBeans and Cordova. To develop Cordova applications, you must install SDKs for each mobile platform you are targeting. This installation is necessary regardless of whether you do the majority of your work in the SDK or use the CLI for your build cycle. Here we will be focusing on the Android platform, so you will need to install the Android SDK first.

More detailed installation instructions can be found here.

Also you will need to install Cordova CLI tools to build the various apps from the command line. Primarily it requires nodejs to be installed. Once nodejs is installed you can then install Cordova.

C:\>npm install -g cordova

Once everything is installed you can check if Cordova is installed correctly by running it from the command line.

C:\>cordova -v
4.2.0

Using NetBeans

Update your NetBeans to the latest version. Later in the ‘tools > plugins’ menu select the ‘Available Plugins’ tab search for ‘cordova’ and install the plugin. Once this is correctly installed you should see a ‘Cordova Application’ project type in the NetBeans menu.

cordova-app

The default Cordova project will create a ‘Cordova Hello World’ app. This will include a ‘index.js’ and ‘index.html’ file.

Select ‘Browser’ as the output for your cordova app from the menu and then run (F6) your app.

cordova-app-2

Once executed the default app should like the following in the browser.

cordova-app-3

Now to install the app in your Android phone, set app output to ‘Cordova (Android Device)’ in the NetBeans menu as specified above. Connect your Android phone to your computer and now run the project again and the app will be installed on your Android phone.