eHouse Smart Home – programming Java

Setting up the development environment NetBeans IDE to create Java applications (standard PC applications, And MIDlet applications on Android)

NetBeans IDE is one of the most popular development environments, especially among novice programmers. In a very simple and quick way to prepare them for Java application development on both the ordinary PC and mobile platforms ( MIDlet and the Android platform) . Another argument is the fact that it is totally free along with most extensions for programming multi-platform in a variety of programming languages ​​and scripts which gives a great field for amateur and professional software development and control for smart home eHouse . Because it is free does not increase the cost of the intelligent home system and allows independent development of the system and to create their own custom algorithms and scripts (following actual needs) or programming languages ​​based on the library eHouse system for different software and hardware platforms.

Before installing an IDE for programming in Java you must download :

  • JRE (Java Runtime Environment ) , containing eg. Java virtual machine and core class
  • development environment JDK (Java Development Kit ) containing mainly Java compiler ( javac ) , Archiver ( jar ) , debugger ( jdb ) and generators header files ( javah ) and documentation ( javadoc )

Both JRE and JDK can be downloaded for free from oracle webpage . JDK includes the JRE , Also you do not need to download it separately.

You can download the NetBeans installer already contains in itself the JDK.

NetBeans can be downloaded for free from the netbeans.org . Before downloading you need to select the appropriate language , operating system ( Windows / Linux / Mac OS / Solaris) and the version of NetBeans depending on the available plugins, to create most applications in the required Java version . You can also download the version containing all plug-ins. The installer allows you to select plug-ins , you want to install . They can also be added later, after installing NetBeans .

All plugins downloaded from the network that you install directly on the C drive , eg. plug on the android install in C:/Android/ . Which helps avoid future problems with file access permissions in Windows that can appear , eg. after installing windows update, service pack, patch or computer security applications.

Installing NetBeans runs quickly. When you start the installer will show the components , which will be installed. First of all, the same IDE ( Base IDE ) and such Java SE, through which you can create Java applications. Clicking Customize we can choose the plug, which will be installed . Click Next and go to the window with the license agreement , I have to accept . After its acceptance will pop up next software license agreement Junit . It is a useful tool for testing and its installation is not required . When you press Next window will appear , where we can set the installation location of NetBeans and indicate the place , where the JDK environment . You might consider changing the default directory ” program files ” for example, a catalog “c:\netbeans” which may facilitate the integration of the environment of the operating system when it comes to permissions to the directory “program files” , that may block future updates , configuration change , etc. .  then press the Next and install in the final summary window installation parameters . Once installed, click Finish and NetBeans is ready for use .

To create a Java application it is best to create a new project . Run NetBeans , click File , and then New Project . A window will appear , the user can select the type of project. Select the Categories Java , a Projects Java Application .
 click Next , in the next window you can specify a name and location of the project . At the end click Finish . The project was created .
 Preparing NetBeans to create java applications for mobile devices called . MIDlet To create a MIDlet is required plug Java ME . If it was not installed with the NetBeans we can add it as follows:

  • In the task bar , select Tools -> plugins
  • On the Available Plugins choose the plug Mobility and install it


Before you can create the first MIDlet must install Java ME SDK (Software Development Kit) containing an emulator and platform , which created the application . Sample SDK can be downloaded from the oracle website.
When installing the Java ME SDK there is a possibility of integration with NetBeans . After installing the SDK open NetBeans and create a new platform :

  • Select Tools – > Java Platforms
  • click Add Platform
  • When a new window , select Java ME MIDP Platform Emulator


4 . When you click Next window will appear with the available platforms . If the list is empty , click Find More Java ME Platform Folders and open the folder , where the previously installed Java ME SDK and click Next . Now the program will find the platform to be installed . Select the platform and install it by clicking Finish .

Now you can create a MIDlet :

  • File – > New Project
  • From the catalog Java ME choose Mobile Application and click Next
  • We give the name and location of the new project , click Next
  • In this window , select the emulator , the target device , its configuration ( eg . CLDC 1 . 1) and the profile (e.g. . MIDP 2 . 0)


click Finish . A new project has been created .

Preparing NetBeans to create java applications for mobile devices on the Android platform For programming on android platform, it is necessary to download the Android SDK (Software Development Kit) for example, from developer.android.com . After download and installation, you must run Android SDK Manager and install a platform such . Android 4 . 0 . 3 .
When writing an application for a specific version of android it is advisable to create a lower version to get the full compatibility for the available phones and tablets.

Then, add the plug-in allows you to create projects NetBeans Android

  • Select Tools – > plugins
  • On the Settings choose Add . In a new window complement the fields as follows:

Name : nbandroid url : kenai.com and click OK

On the Available Plugins there will be new items . We are searching the plug Android and install it .

Now you need to add a location for Android SDK , to use the available platforms .
For this purpose, enter :

  • Tools – > Options
  • On the Miscellaneous and card Android enter the location for the android SDK and click OK

 . Now you can create designs for Android , selecting the appropriate platform on the way you program the .