© Ioannis Kostaras, Constantin Drabo, Josh Juneau, Sven Reimers, Mario Schröder, Geertjan Wielenga 2020
I. Kostaras et al.Pro Apache NetBeanshttps://doi.org/10.1007/978-1-4842-5370-0_1

1. What Is Apache NetBeans

Ioannis Kostaras1 , Constantin Drabo2, Josh Juneau3, Sven Reimers4, Mario Schröder5 and Geertjan Wielenga6
(1)
The Hague, South Holland, The Netherlands
(2)
Ouagadougou, Burkina Faso
(3)
Chicago, IL, USA
(4)
Salem, Germany
(5)
Berlin, Germany
(6)
Amsterdam, The Netherlands
 

It isn’t often that a technology sweeps the world and ends up being a relevant piece of the technological universe for over 20 years. However, the Java language is one of the few that has. The Java programming language was originally developed in 1995 by Sun Microsystems, and it has grown into a massive ecosystem over the years. The Java Virtual Machine (JVM) is a virtual computer that is defined by a specification, and the Java programming language can be used to program applications that run on the JVM. A JVM can be installed on just about any computer or hardware device that is available on the market. As such, the JVM is installed on millions of devices worldwide, and there have been dozens of different programming languages built on top of the JVM that compile down to Java byte code, allowing developers to utilize different language syntax to run on the JVM. What does this mean? Well, frankly it means that the JVM and Java are everywhere, and one can use a multitude of languages to program applications that will run just about anywhere. Java is an ecosystem that started in 1995, and it will be around long into the future.

As developers on one of the most prominent development platforms, folks can develop applications in a number of different ways. It is possible to develop Java code in a text editor, compile and run it via a terminal using the java executable, and then be on your way. It is also possible to create libraries of files and projects all via the terminal, without the use of any specialized tools for development. However, although it can be done, development without a code editor or a “development environment” including a project-based system, can be cumbersome, and Apache NetBeans is one of the most popular development environments for the Java Platform that helps to make development easy. Although Apache NetBeans is a great development tool, it is much more than just an editor. Apache NetBeans is a comprehensive development tool with support for several languages; it is a development platform for creating rich client applications; and it is a vibrant open source community with members from around the globe.

The Journey to Apache NetBeans

In 1996, a student project was started under the guidance of the Faculty of Mathematics and Physics at Charles University in Prague. This student project aimed to make the development of Java much easier, providing a syntax editor for the code that would help to reduce errors and speed up development time when programming. It allowed one to compile and build entire projects with just a few clicks of a button. This project was originally named Xelfi, and in 1997 a company was formed around the project and it was renamed to NetBeans IDE. Sun Microsystems liked the project so much, that they purchased it in 1999 and open sourced the NetBeans IDE a year later.

After Sun Microsystems purchased Apache NetBeans, the user base and community began to thrive. Primarily developed and maintained by Sun Microsystems at the time, the community was able to provide patches, enhancements, and so forth since the IDE was open source. However, the overall road map and direction of NetBeans was controlled by the commercial entity. That wasn’t necessarily a bad thing, as it helped to foster the IDE and the Java ecosystem as a whole, since NetBeans was being targeted toward both beginners and experienced Java developers alike.

NetBeans was part of the portfolio that Oracle had purchased from Sun Microsystems in January of 2010. As part of that portfolio, Oracle strived to drive NetBeans forward as the first IDE that would support the latest features of Java SE and Java EE alike. Oracle also strove to make NetBeans an IDE for many languages; they even hired Python and Ruby developers to help foster the JVM counterparts of those languages, Jython and JRuby respectively. As part of that initiative, NetBeans IDE gained support for these languages via the use of separately installed NetBeans modules. Since NetBeans was developed as a modular IDE, it was easy to add functionality as time went on, without increasing the footprint of the core IDE.

Oracle did a great job of moving NetBeans forward: it was still an open source IDE, and the community also played an important role. However, Oracle still drove the road map, and it was not very straight forward to become involved contributing code to NetBeans under the Oracle open source process. The NetBeans community has developed conferences organized around the IDE. Many have developed modules to extend the IDE. Even more have given talks or written tutorials about NetBeans features. The next step in the evolution of the IDE was to make contribution easier, and to give the IDE road map and sources to the community.

Oracle donated the NetBeans IDE sources and tutorials to Apache in the fall of 2016. Even though Oracle donated the IDE to Apache, it still remains very much involved in the development of Apache NetBeans, but the community now controls the road map. Contributing to Apache NetBeans is now as easy as creating a GitHub Pull Request. Since the donation, Apache NetBeans has changed its release cadence so that its releases are now more closely targeting the Java release cycle. Apache NetBeans still continues to be the first IDE to support the latest flavors of the JDK, and the community is as vibrant as ever.

Installing Apache NetBeans

There are a couple of different ways to install Apache NetBeans onto your machine, depending upon your uses. For those who are interested in modifying Apache NetBeans, the IDE can be built from source after cloning the Git repository. For those who are simply interested in utilizing Apache NetBeans as a development tool, the archive can be downloaded and extracted, and then the executable can be invoked. This section will briefly explain how to install by extracting Apache NetBeans. If you are interested in building from source, please refer to Chapter 14.

The initial requirement for utilization of Apache NetBeans is the installation of a Java Development Kit. Apache NetBeans supports JDK 8 and 11. The JDK must be installed in order to build the IDE from source or to run the IDE. To download Apache NetBeans, visit the downloads area at https://​netbeans.​apache.​org/​download/​ and obtain the most recent release. The downloads page includes links to obtain the sources or binaries for each of the releases. It also contains information about building the IDE from source. To download the binaries, click on the “Binaries” link, and then the “Apache Download Mirrors” page will be displayed. Choose a download mirror and click to obtain the archive.

Once the archive has been downloaded, extract within a folder. The extracted archive should resemble that in Figure 1-1. The executable is contained within the bin directory.
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig1_HTML.jpg
Figure 1-1

Apache NetBeans Installation

If more than one Java installation exists, edit the etc/netbeans.conf file accordingly and add the JAVA_HOME that should be used for running Apache NetBeans. To run Apache NetBeans, double-click the executable for the corresponding workstation’s platform, which resides within the bin directory.

Note

To learn how to build Apache NetBeans from source, please refer to Chapter 14.

Integrated Development Environment

Apache NetBeans is most widely known as an Integrated Development Environment (IDE). That is why it is commonly referred to as NetBeans IDE. Originally made to be a development environment for Java, the breadth of Apache NetBeans IDE has grown immensely over the years into a development tool for many different languages. As of the release of Apache NetBeans 10, the IDE contains first-class support for a variety of languages, including Java, PHP, and JavaScript. Support not only means that the editor contains nice syntax coloring or keyword highlighting, but it also typically contains features such as automatic indentation as per language standards, auto-completion for keywords and code fragments, and in some cases also automated rebuilds of projects for an easy debugging and development life cycle. The source code editor makes it easy to jump to different portions of code using keyboard shortcuts and mouse clicks. The editor font, color, etc., can be modified within the Apache NetBeans preferences.

Did I mention debugging? Yes, the development environment also contains a full debugger for various languages, including the ability to set breakpoints, review variable values during live debugging, and perform hot code refreshes. The development environment also contains a full-fledged performance tuning solution for Java applications. One can use the performance tools to run an application and pinpoint code issues or threads that may be causing problems.

When it comes time to build a project, few build frameworks that are as widely used as Apache Maven. The Apache NetBeans IDE contains outstanding support for Apache Maven, making a sometimes daunting build framework easy to use. If one chooses to utilize XML directly for pulling in Maven dependencies, then the XML editor is there to assist through the process, but if one would rather simply type in required dependencies and have them automatically added, then that is another option.

One of the most important pieces of the development process is workflow and team collaboration. The NetBeans IDE contains first-class support for version control systems such as Git and Subversion, making collaboration a breeze. It is possible to clone Git repositories, update code, commit changes, and push to remote repositories right within the IDE. It is also easy to compare differences between files using the DIFF comparison tool.

Over the next few sections, we will go through some of the basic Apache NetBeans IDE features for some of the most common use cases.

Java Code Editor

First and foremost, Apache NetBeans IDE is a world-class Java editor. The editor contains a number of features to assist developers, making all aspects of application development more productive. Although this section highlights Java code editing features specifically, it should be noted that many of these same features are available for other languages, such as JavaScript and PHP.

Code completion provides developers with a boost by making code easier to write with less keystrokes, and also because it is great for typing those method names and variables that you don’t quite remember. The code completion is automatically invoked by pressing CTRL-Space while typing. Doing so will cause a drop-down menu to appear, which includes a number of code suggestions for continuing your current line of code. The code suggestions are context-based, providing meaningful suggestions for the current code at the top of the list, and less meaningful suggestions toward the bottom. Of course, code completion is configurable, so it can be made to automatically open the code completion drop-down menu while typing or when typing certain characters. By default, when a “.” character is typed, context-based suggestions will appear, which can be beneficial for easily completing method names and so forth.

Code templates and snippets are handy for inserting segments of skeleton code, as needed, making it easier to complete logic. Templates can be invoked by clicking on a suggestion icon or by typing various strings of code such as “sout”. When “sout” is typed and then the spacebar is pressed, the code “System.out.println(“”)” is expanded, leaving the cursor within the parentheses to continue typing. One can define custom code snippets for code that is often used. There are also refactoring options for automatically completing simple boilerplate code, such as creating getters and setters, without coding at all.

Java SE Applications

Apache NetBeans was originally built for development of Java Standard Edition (Java SE) applications: that is, a Java application that contains one or more Java classes, a starting point, and an action or graphical user interface that provides functionality for a user. Traditional Java development requires Java classes to be compiled before they can be executed. Compiling and execution of an application typically occurs via a command prompt or terminal, utilizing the javac compiler and the java command to execute resulting class files. What’s more, if an application consists of more than one class file or resource, then it must be packaged into a Java Archive (JAR) before it is executed. Performing these tasks manually can be time consuming and cumbersome. Why not automate these minuscule tasks so that the developer can spend more time creating, rather than performing routine tasks? That is the original intention of Apache NetBeans IDE … to make development easier and more productive by reducing the number of required routine tasks.

Note

Prior to installing Apache NetBeans, be sure to have a JDK installed. If you are planning to develop Java EE/Jakarta EE applications, be sure to install the version of the JDK that you will be using for the container to which the application is deployed. Once installed, the netbeans_jdkhome configuration variable, located within etc/netbeans.conf, should be assigned the path to the JDK you are using to run Apache NetBeans.

Let’s walk through the development of a simple “Hello World” Java application and introduce some of the core features of Apache NetBeans IDE. To begin, open Apache NetBeans and create a new project by choosing “File” ➤ “New Project” or selecting the “New Project” icon in the toolbar.

Next, within the “New Project” dialog, choose the “Java” category from the Categories pick list, and then select “Java Application” from the Projects pick list. A New Java Application dialog will appear (Figure 1-2), and a Project Name, Project Location, and Project Folder can be provided. Type “HelloApacheNetBeans” as the project name.

Next, select a location on your computer in which to store the project files. Apache NetBeans allows one to provide a common area for storing third-party libraries, but skip that for now, and ensure “Create Main Class” is checked, maintaining the default Main Class name. Click “Finish” to create the project.
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig2_HTML.jpg
Figure 1-2

New Java Application Dialog

Apache NetBeans will open the HelloApacheNetBeans main class in the editor, and you will see that the project has been added to the left-hand navigator (Figure 1-3). When the project menu in the left-hand navigator is expanded, a single source file named HelloApacheNetBeans.java is displayed within the package helloapachenetbeans, and the default JDK that is registered with Apache NetBeans can be seen under the Libraries node. The HelloApacheNetBeans.java file is opened in the source editor by default.
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig3_HTML.jpg
Figure 1-3

Project Menu

The project is displayed in an enhanced format, making it easy to navigate the project files and see project dependencies. At the top of the left-hand navigator, there are tabs for “Project,” “Files,” and “Services.” The “Project” tab is displayed by default, and it will contain each of the currently open Apache NetBeans projects in the enhanced view. The “Files” tab shows each of the currently open Apache NetBeans projects using the actual project files as they can be seen on disk. Sometimes this can be useful if you know where a certain file is placed and you need to edit it. It also can be useful because Apache NetBeans will hide some of the project files by default to organize the project and make navigation easier, and also because these hidden files should not need to be edited in most cases. The “Services” tab contains a multitude of options for working with databases, web services, Maven repositories, Docker, etc. Many of these various services will be covered later in this book in detail.

To get an opportunity to work within the editor, place the cursor within the main() method of the HelloApacheNetBeans.java file in the open editor, after the code comment that reads as follows:
// TODO code application logic here
Press the return button to start a new blank line, and begin typing: System.out.println("Hello Apache NetBeans"); While typing, auto-completion options are presented to make coding easier. In fact, by simply typing sout and pressing the tab button, the line will be auto-completed using a code template. Type the string “Hello Apache NetBeans” within the println() method. The code should look like that below:
public static void main(String[] args) {
  // TODO code application logic here
  System.out.println("Hello Apache NetBeans");
}
Within the project navigator, the right-click provides many additional options, as it brings up the contextual menu. Most of these options will be covered later in the book, but for now right-click on the HelloApacheNetBeans project within the project navigator and select “Clean and Build.” Doing so removes any compiled code from disk, and performs a build including any external dependencies for the project. Next, right-click on the project name and click “Run.” Below the editor resides a number of tabs, and one of them is the “Output” tab. When the project is run, the “Output” tab should display the following:
run:
Hello Apache NetBeans
BUILD SUCCESSFUL (total time: 0 seconds)

Java Web Applications

Java web applications typically have a number of processes that need to be coordinated in order to develop and test. For instance, most web applications need to be deployed to an application server container of some kind, and many access a database. Apache NetBeans allows for easy development, deployment, and testing of Java web applications by allowing one to maintain all of these separate processes within one place. What’s more, it contains a debugger mode that will easily allow one to deploy an application in debug mode and then step through breakpoints to help troubleshoot issues. See Chapter 5 for more details on the debugger.

Java web applications typically contain a number of different code and styling files, and the Apache NetBeans code editor is capable of editing just about any file. The code editor supports many different languages with features such as syntax highlighting, auto-completion, and error marking. When working with web applications especially, having the ability to edit different types of files within the same editor is essential. The Apache NetBeans plugin portal also provides the ability for developers to create third-party extensions for the IDE, making the possible supported files and options for expansion unlimited. For instance, there are third-party plugins available for many application server containers, allowing special functionality to be made available for these servers. See Chapter 11: Writing a Plugin for NetBeans for more details.

There are multiple options for developing web applications within Apache NetBeans. Each option contains a different project type. There are three options available under the “New Project” dialog’s “Java Web” category: Web Application, Web Application with Existing Sources, and Web Free-Form Application. The “Web Application” is typically used to create a new web application project using Apache Ant for a build system. Such a project would require the developer to manually handle resources using Apache Ant. The “Web Application with Existing Sources” allows one to create a project from an existing Apache Ant-based web application. There are other available options for creating web applications utilizing the “Java EE” and “Maven” categories. Typically, older style Java Enterprise applications can be created from the options within the “Java EE” category. The “Maven” category provides options for creating Java EE projects using the Apache Maven build system. If unsure where to start, the safest and most modern style of web application project can be created by choosing the Maven “Web Application” project.

Note

If using Apache NetBeans release prior to 11.0, you will need to install the “Java EE” plugin in order to create a new web application project. In release 11.0+, the plugin is integrated within the IDE.

Let’s walk through the development of a simple “Hello World” web application. First, open the “New Project” dialog and choose “Java Web” category, followed by the “Web Application” project type. Once selected, the “New Web Application” dialog will be displayed. Name the web application “HelloWorldWeb,” and choose a good location for the project (Figure 1-4).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig4_HTML.jpg
Figure 1-4

New Web Application Dialog

Click next, and then select an application server and “Java EE Version” to support. In this case, the “Payara 5.183.1” server is selected (see section on how to add a new server to Apache NetBeans), and “Java EE 7 Web” is selected as the Java EE Version. Leave the Context Path as is (Figure 1-5).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig5_HTML.jpg
Figure 1-5

Server and Settings

The final section to the “New Web Application” wizard is the Frameworks dialog. In this section, if you’d like to use a particular Java Web framework, you could select it here to add any required dependencies and configuration files for the chosen framework. In this case, do not select anything and simply click “Finish.” The project will appear within the “Projects” navigator in the left-hand menu, and the index.html file for the project will open within the editor. The project contains the following nodes: “Web Pages,” “Source Packages,” “Libraries,” and “Configuration Files,” as seen in Figure 1-6.
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig6_HTML.jpg
Figure 1-6

Java Web Project Structure

At this point, the project is ready to be deployed to the designated application server, and that can be done by right-clicking on the project and choosing “Run.” By selecting “Run,” the designated application server will start and the application will be compiled and deployed. The editor that contains the HTML file will provide options for editing HTML, and if a CSS or JavaScript file is created, then the editor will provide options that are specific to those types of files. Of course, all of the features that are available for Java SE projects are also available for Java Web projects.

PHP and Other Languages

Although Apache NetBeans was originally created for the development of Java applications, over the years the community has added support for a number of other languages. One such language that has outstanding support in Apache NetBeans is PHP. Another well-supported language is JavaScript. In Apache NetBeans 10, PHP gained full support within the IDE, so features such as multi-catch exception handling, nullable types, context sensitive lexer, etc., are available. The code editor contains PHP-specific features, such as hints for void return types, hints for incorrect non-abstract methods, suggestions for strict types declaration, etc. There is also support for an HTML forms palette to aid in development of PHP web forms.

To create a PHP project, there are a few options placed under the “New Project” ➤ “PHP” category. The options are as follows: “PHP Application,” “PHP Application with Existing Sources,” and “PHP Application from Remote Server.” The first option allows one to create a PHP project from scratch, providing flexibility for debugging and running the project. The second option, “PHP Application with Existing Sources,” allows one to import an existing PHP project into a standard IDE project and begin working with it right away. The third option allows one to download a remote project, for which a standard IDE project is created. The third option also automatically configures the newly created standard IDE project such that it will automatically upload local changes to the remote server.

Maven Support

The most prevalent build system for Java applications is Apache Maven. Therefore, it is no surprise that Apache NetBeans has first-class support for this build system. The IDE contains various starter projects that are based upon the Apache Maven project format. Any Maven project can be opened in Apache NetBeans IDE, and immediately it will be recognized so that development can begin.

To open an existing Maven project within Apache NetBeans, simply browse to the project using the file explorer and open. The IDE will automatically detect the language type and open a project utilizing the template that pertains to the selected project. For instance, if a Java SE Maven project is opened, then the Java SE Apache NetBeans project template will be utilized.

Using Maven, project dependencies are downloaded and added to the resulting archive file when a project is built. Therefore, when the “Build with Dependencies” option is utilized in Apache NetBeans, Maven does just that. It is also easy to add dependencies to a project by right-clicking the “Dependencies” node within the project navigator and selecting “Add Dependency” (Figure 1-7).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig7_HTML.jpg
Figure 1-7

Add Maven Dependency

After clicking the “Add Dependency…” option, the “Add Dependency” dialog appears, allowing one to easily search for dependencies found in remote or local Maven repositories (Figure 1-8). When a dependency is added to the project, the associated project POM file is modified to include it, so that the user does not have to manually modify the XML.
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig8_HTML.jpg
Figure 1-8

Add Dependency dialog

Other Maven support features include the ability to integrate SureFire tests within Maven builds; utilizing Apache Maven as build systems for various project types including other JVM languages, ApacheNetBeans plugins, etc.; and easy editing of POM files with auto-completion for dependencies.

Collaboration

The Apache NetBeans IDE helps teams work easily together using integrated support for version control systems (VCS) such as Git, Mercurial, and Subversion. The IDE contains first-class support for these VCS, as each Apache NetBeans project can be managed separately from within the IDE. Prior to integrating with either of the VCS, the system of choice must be installed on the same workstation as Apache NetBeans. The Apache NetBeans Preferences “Team” ➤ “Versioning” tab can then be used to manage the VCS of choice (Figure 1-9).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig9_HTML.jpg
Figure 1-9

Apache NetBeans Version Control Preferences

The next couple of paragraphs will outline the Apache NetBeans Git support. However, the same level of support is available for Mercurial or Subversion as well. The “Team” menu provides options for creating new or browsing existing repositories (Figure 1-10).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig10_HTML.jpg
Figure 1-10

Apache NetBeans Team Menu

The “Open Global Configuration” option provides the ability to manage the global .gitconfig file directly within the editor, as seen in Figure 1-11.
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig11_HTML.jpg
Figure 1-11

Managing Global Git Configuration File

There are also VCS options available within the contextual menu by right-clicking an Apache NetBeans project. Options include the ability to initialize a repository (Figure 1-12), and a host of available options are available for working on the VCS repository for projects that have already been initialized and have a repository (Figure 1-13).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig12_HTML.jpg
Figure 1-12

Initializing a Repository for an Apache NetBeans Project

../images/479166_1_En_1_Chapter/479166_1_En_1_Fig13_HTML.jpg
Figure 1-13

Git Options for Initialized Project

The IDE contains an integrated Push/Pull system for the VCS, so if a project contains files that have been modified and differ from the HEAD, then the text for those files turns green. It is then easy to perform a DIFF comparison between the HEAD and currently selected file, and commit changes to a repository simply by choosing options within the contextual menu and using the dialogs (Figure 1-14).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig14_HTML.jpg
Figure 1-14

Comparing Files Using DIFF

Apache NetBeans covers many more version control features. To see more information about such features, please refer to online resources for using Git with Apache NetBeans: https://netbeans.apache.org/kb/docs/ide/git.html or Mercurial: https://netbeans.org/kb/docs/ide/mercurial.html just to name a few.

Profiling, Debugging, and Refactoring

The Apache NetBeans IDE contains excellent profiling, debugging, and refactoring abilities. The profiler allows one to dig into the internals of application method calls to pinpoint troublesome areas. The Telemetry profiler screen provides an overview of CPU and Garbage Collector, Memory, Garbage Collection, and lastly, Threads and Classes. The CPU and Garbage Collector chart allows drilling in to specific times to find CPU and GC Time, Memory provides Heap Size and Used Heap, Garbage Collection displays Surviving Generations, and the Threads and Classes chart shows just that, the number of threads and loaded classes (Figure 1-15).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig15_HTML.jpg
Figure 1-15

Telemetry Display

Process buttons invoke certain functions, such as garbage collection at-will. Method profiling allows one to profile all classes, project classes, or selected classes only. The user interface makes it easy to drill into single method calls to pinpoint problems (Figure 1-16).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig16_HTML.jpg
Figure 1-16

Methods Profiler

The object profiler enables sorting of objects by size, and double-clicking an object will take you directly to the sources (Figure 1-17).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig17_HTML.jpg
Figure 1-17

Object Profiler

These features just scratch the surface of the Apache NetBeans profiler. The debugger allows one to set breakpoints in code, and then execute the code (locally or deployed to server), and step through the code to help debug and find the cause of issues. Once a breakpoint is set in the code, the debugger will stop execution at the breakpoint, and the IDE will display the values of variables at that time (Figure 1-18).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig18_HTML.jpg
Figure 1-18

Apache NetBeans Debugger

The debugger also allows one to set watches on variables, enabling the code execution to stop when a variable contains a specified value. There is also a snapshot option that allows snapshots to be taken at specified times so that code can be monitored as it is executing. If developing a JavaFX or Swing graphical user interface, there is a visual debugger that allows viewing of component properties, components within a container, and more. Please refer to Chapter 5 to learn more about the debugger and profiler.

Another key component of an IDE is the ability to refactor code. Apache NetBeans allows one to change the name of code files, automatically add code such as getters and setters, change method parameters, and more (Figure 1-19).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig19_HTML.jpg
Figure 1-19

Apache NetBeans Refactor Context Menu

Apache NetBeans Platform

Apache NetBeans is much more than an IDE for applications. The IDE is built on a platform designed specifically for the purpose of creating rich client desktop applications ... the NetBeans Platform. As it turns out, the platform is extremely extensible and can be very useful for developing any number of desktop-based applications for the Java Platform. In fact, there are many successful applications that have been built upon the NetBeans Platform ranging from entire desktop applications to useful utilities. The NetBeans Platform also enables one to easily build modules that can be installed to extend Apache NetBeans IDE. The IDE itself contains project templates that can be used for building applications and modules that utilize the NetBeans Platform.

To develop a NetBeans module, open the “New Project” dialog and select the “NetBeans Modules” category (Figure 1-20). There are a number of options from which to choose for creating a NetBeans module, ranging from development of a single module, to a module library, to an entire NetBeans Platform Application.
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig20_HTML.jpg
Figure 1-20

New Project: NetBeans Modules

Development of Standalone Apache NetBeans Modules

In many cases, developers wish to build extensions to the Apache NetBeans environment. There have been many dozens of useful NetBeans modules created by developers in the community. Such modules extend the IDE to incorporate new and/or enhanced functionality. Extensions can encapsulate almost any functionality. For instance, a module can be used for adding new language support to the IDE, or for extending existing functionality such as adding enhanced Git support. Whatever it may be, Apache NetBeans modules are easy to develop using the project templates.

To get started, select the “NetBeans Modules” ➤ “Module” project type. Once selected, the new module can be created as a “Standalone” module or it can be added to a “Module Suite.” On the next panel, a “Code Name Base” must be specified. The “Code Name Base” is much the same as a base package name (Figure 1-21). A package localizing bundle can also be specified, as well as the option to generate the module as an OSGI module.
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig21_HTML.jpg
Figure 1-21

New Module Wizard

The project structure is very similar to that of a Java SE project, although there are a number of configuration files that are generated that are particular to the module (Figure 1-22).
../images/479166_1_En_1_Chapter/479166_1_En_1_Fig22_HTML.jpg
Figure 1-22

NetBeans Module Structure

The module will create an NBM file, which can later be added as an extension to NetBeans IDE. The module can also be deployed as a NetBeans plugin for distribution.

Development of Applications Built on the NetBeans Platform

The NetBeans Platform allows developers to architect-rich client applications utilizing a skeleton framework that provides many under the cover features for free. The platform allows development of Java Swing applications in a fraction of the time that it would take to develop one from scratch. The platform includes features such as state saving and life-cycle management, standardized UI toolkit, window system; and all of these features are easy to implement out of the box.

When developing on the NetBeans Platform, the IDE allows for easy debugging into modules or platform applications. As such, this makes it easy to rapidly create stable user interfaces that utilize a standard architecture. Since the platform provides many essential client-side application APIs out of the box, you can be certain that all standard NetBeans Platform applications behave in a consistent manner.

Apache NetBeans Community

Apache NetBeans has a vibrant community consisting of several online resources, frequent conference speakers and sessions, and a rich history of documentation and tutorials. The Apache NetBeans community has been around since the early 2000s, and it has grown tremendously over the years from a small core group to an entire open source community.

Mailing Lists and NetCAT

One of the most basic and informative ways to become a part of the Apache NetBeans community is to join the mailing lists. The lists are frequently used to post questions and to discuss new and existing features for the IDE. The lists are also useful for learning how an open source community functions, as there are always seasoned experts on the lists ready to assist. To join the Apache NetBeans mailing lists, visit the following webpage:

https://​netbeans.​apache.​org/​community/​mailing-lists.​html

Prior to an Apache NetBeans release, the impending release must be tested to ensure full functionality. One of the phases of Apache NetBeans testing is the NetCAT program. NetCAT is a community of testers that are each assigned to test different portions of the IDE. The IDE functionality is broken up into different NetCAT organizational groups. Each group meets periodically online to formulate plans for testing, and each tester completes test cases using an online form. Becoming a NetCAT tester can provide you with more knowledge of the Apache NetBeans IDE and allow you to give back to the community by helping to weed out issues. Learn more about joining NetCAT using the link mentioned for the Apache NetBeans mailing lists.

Tackle an Issue

One of the most important ways that one can contribute to the Apache NetBeans ecosystem is to find an issue on the Apache NetBeans JIRA (issue tracker) and repair it. This is easy to do by simply creating a fork of the Apache NetBeans GitHub repository, and then making the necessary code updates to repair the issue within the fork. Once the issue has been repaired, changes within the fork can be added back to the Apache NetBeans GitHub repository by submitting a Pull Request. To learn more about contributing code to Apache NetBeans, please refer to Chapters 14 and 15.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.133.228