Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Mastering Netbeans
  • Table Of Contents Toc
  • Feedback & Rating feedback
Mastering Netbeans

Mastering Netbeans

By : David Salter
5 (1)
close
close
Mastering Netbeans

Mastering Netbeans

5 (1)
By: David Salter

Overview of this book

With the increasing complexity of software development and the abundance of tools available, learning your IDE in-depth will instantly increase your developer productivity. NetBeans is the only IDE that can be downloaded with Java itself and provides you with many cutting edge features not readily available with many IDEs. The IDE also provides a great set of tools for PHP and C/C++ developers. It is free and open source and has a large community of users and developers around the world. This book will teach you to ace NetBeans IDE and make use of it in creating Java business and web services. It will help you to become a proficient developer and use NetBeans for software development. You will learn effective third-party interaction and enable yourself for productive database development. Moving on, you will see how to create EJB projects and write effective and efficient web applications. Then you will learn how to use Swing and manage and configure a relational database. By the end of the book, you will be able to handle external services such as databases, Maven repositories, and cloud providers, and extend your NetBeans when you require more from your IDE.
Table of Contents (12 chapters)
close
close
11
Index

Building NetBeans

Once we've downloaded the source code for NetBeans, we can build it either using the command line or via NetBeans.

To build the NetBeans IDE from the source code, we need to have the following software installed first:

  • JDK 7
  • Apache Ant

Tip

NetBeans can be built with JDK 8, but additional steps are required for this; we'll see what these are shortly!

Building NetBeans via the command line

To build NetBeans via the command line, open up a terminal or command prompt and change the directory to the directory containing the source code. Executing the ant command will build the source code, downloading any external dependencies that are required:

[david:~/Develop/NetBeans/main-silver]$ ant

If you are running JDK 8 instead of 7, you will be presented with an error when attempting to build the source code stating that builds are forbidden when using JDK 8. This error is presented so as not to introduce any Java 8 features into the source code.

Building NetBeans via the command line

If you wish to use JDK 8 to build the code, you can set the permit.jdk8.builds property to true:

[david:~/Develop/NetBeans/main-silver]$ ant –Dpermit.jdk8.builds=true

Alternatively, if you have both JDK 7 and 8 installed, you can set the nbjdk.home property to point to a valid JDK 7 installation and the build will then complete using the specified JDK 7 instead of JDK 8.

Once you have successfully build NetBeans, you can execute the freshly built instance by executing the ant tryme task:

[david:~/Develop/NetBeans/main-silver]$ ant tryme

This will execute the instance of NetBeans that you have just built using <build-location>/nbbuild/testuserdir as the user directory. The actual instance of NetBeans is stored within the <build-location>/nbbuild/netbeans folder.

Building NetBeans via the command line

Alternatively, you can also start the freshly-built instance of NetBeans by executing the netbeans or netbeans.exe commands from within the <build-location>/nbbuild/netbeans/bin directory, either from the command line of Windows / Linux explorer or Mac OSX Finder.

Building NetBeans from within NetBeans

Now that we've seen how to build NetBeans via the command line, let's see how we can build it from within NetBeans itself.

If you cloned the NetBeans source code via the team support in NetBeans, then the NetBeans Build System project will already be opened within NetBeans, ready for building, as shown in the following screenshot:

Building NetBeans from within NetBeans

If you cloned NetBeans via the command line, you will need to open the NetBeans Build System project located within the main-silver/nbbuild directory.

Building NetBeans from within NetBeans

After opening the project, you will see that there are error badges shown against the Ant Tasks and Tests for Ant Tasks project nodes within the Projects window. These errors simply indicate that artifacts needed for the build haven't been downloaded yet; the build process will download the necessary files, and once built, these error badges will no longer appear.

To start building NetBeans, we must first build the necessary Ant tasks that the full build process relies on. To perform this, right-click on the NetBeans Build System project and select the Build option:

Building NetBeans from within NetBeans

Once the build system is completed with no errors (you will see several warnings displayed during the build process, but these can be safely ignored), you can build NetBeans by right-clicking on the NetBeans Build System project and selecting the Build IDE (No ZIP File) option:

Building NetBeans from within NetBeans

If you are using JDK 7, you will see that NetBeans is built correctly after a few minutes of activity.

If you are using JDK 8, you will see a failure message in the NetBeans output window, indicating that the project cannot be built using JDK 8, as shown in the following screenshot:

Building NetBeans from within NetBeans

Since NetBeans provides its own installation of Ant to build projects, if we wish to use JDK 8 to build NetBeans, we must configure the permit.jdk8.builds property before attempting to build.

To configure the Ant properties from within NetBeans, perform the following steps:

  1. Open the NetBeans Options dialog. On Windows and Linux, this is achieved by selecting Tools and then Options from the main menu. On Mac OS X, clicking on NetBeans and then Preferences from the application menu opens the Options dialog.
  2. In the Options dialog, click on the Java option and then choose the Ant tab.
  3. Within the Ant tab, append the permit.jdk8.builds=true line into the Properties edit box:
    Building NetBeans from within NetBeans
  4. Click on the OK button to save the configuration changes.

Now that we've configured the permit.jdk8.builds property for the internal instance of Ant, we can build the project successfully using JDK 8. This is achieved by right-clicking on the NetBeans Build System project within the Projects window and selecting the Build IDE (No ZIP File) option.

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Mastering Netbeans
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon