Although Java programs code be written using Notepad, or Notepad++ (in Windows), or using vi/vim editor in UNIX/Linux, IDEs are another story. If you have time, let me tell you that story; it is really exciting.
What is IDE?
IDE stands for Integrated Development Environment. It is software that gives computer developers (in general, not only Java developers) great capabilities which make the developing process easier and more efficient, hence increasing productivity.
The essential component in all IDEs is the source code editor. Usually these editors have the necessary intelligence to provide developers with good help. Some of the facilities that IDE software editors provide are:
- Code Auto-completion.
- Recognizing and coloring the keywords, the built-in methods and classes, and the comments.
- Tracing the opening and closure of curly brackets, single, and double quotes.
- Error checking.
- Code generator.
Besides to the code editor, IDEs offer various facilities that differ from one IDE to another, like compiler (for compiled languages), interpreter (for interpreted languages), and project builder for testing the program code.
Examples for commonly-used IDEs are Turbo and Borland C++ (for C and C++ developing), Microsoft Visual C++ (for developing applications using C++ and Visual C++), IDLE (for developing in Python), Netbeans, and Eclipse for Java.
The good news is: most of these IDEs are completely free. So, cheer up.
In the following sections, we are going to learn how to download and install NetBeans.
NetBeans is a very rich tool for developing Java programs. Let’s install it, and let the tool talk about itself. To download and install the NetBeans, follow this simple procedure:
1. In your web browser, browse to https://netbeans.org/
2. Click Download
3. The NetBeans IDE 8.0.2 Download page is opened.
As you could see, there are several packages available for download with different options (and different programming languages), and all are free. The one with least size (Java SE) will be sufficient, so you can download it. For me, I will download the complete version (headed with the word All). So, click Download to start downloading the package of your choice.
4. The following page is opened, and the download starts.
The download would take few minutes, depending on the size of the package you chose (and of course you internet speed).
5. When download is complete, double-click the downloaded installation package file.
6. The following dialog is displayed.
7. The default options will install almost everything, so you can click Next.
8. Check the checkbox to accept the license agreement, and click Next.
9. When prompted, choose the “I accept the terms in the license agreement. Install JUnit” to install JUnit, then click Next.
10. By default, the NetBeans will be installed on C:\Program Files\NetBeans 8.0.2
Click Next to accept this default installation path.
11. Click Next one more time, then Install. Now, get back in your chair and relax, or have a cup of coffee until the installation is complete.
12. When done, click Finish to complete the installation.
In this section, we are going to see how to write Java programs using IDE. We will re-write our first program (that was presented in the past article).
1. Double-click the NetBeans shortcut on the desktop (or open it from the Start menu).
2. From the File menu, click New Project. The following dialog is displayed.
3. Make sure Java and Java Application are selected, and click Next.
4. The following Dialog is opened.
5. In the Project Name textbox Type “Hello”, and click Finish.
6. The following Project window is displayed.
A source code file named Hello.java is created for you, and opened for editing. Notice also that some code is generated. The NetBeans Wizard has defined a hello package, a public class named Hello, and a main() method with empty body that is ready to be filled in. My God!! That is GREAT!!
7. Type the program: actually, all we need to do is just type the line:
System.out.println("Hello, I am a Java programmer");
inside the body of the main() method, so type it anyway.
8. In the toolbar, click the Green Arrow button to run the program.
9. A new pane is displayed on the lower right part of the NetBeans window. The Output pane displays the output of the program.
You have just written, compiled, and executed a Java program using JavaBeans. Congratulations!!
* * * * * *
In this article, we have talked about IDEs. An IDE is a software application that provides the developer with useful tools to facilitate his work, and increase his productivity. Many IDEs exist, and most of them are free. Of the long list of available IDE tools, we chose to illustrate the installation and usage of two well-known Java IDEs: NetBeans (the subject of this article), that we have already learned how to download, install, and write programs in, and Eclipse, which will be the subject of the next article. So, don’t miss it.