Book Image

OpenJDK Cookbook

Book Image

OpenJDK Cookbook

Overview of this book

Table of Contents (20 chapters)
OpenJDK Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Debugging Java code using NetBeans


Obviously, when someone is writing any code, some debugging is required. It is no surprise that NetBeans, as a high-standard IDE, provides some tools to do that. This recipe will show how to debug the Java code using NetBeans.

Getting ready

You will need to install NetBeans and set up a development environment, as described previously in the chapter.

How to do it...

We will use NetBeans to debug our own OpenJDK Java code. We will need to rebuild OpenJDK with debug symbols, and configure NetBeans to make debugging possible:

  1. First, let's make our OpenJDK instance with debug symbols:

    bash ./configure --enable-debug
    make all CONF=linux-x86_64-normal-server-fastdebug
    
  2. Let's ensure that a debuggable version is built:

    ./build/linux-x86_64-normal-server-fastdebug/jdk/bin/java -version
    openjdk version "1.8.0-internal-fastdebug"
    OpenJDK Runtime Environment (build 1.8.0-internal-fastdebug-dsmd_2014_03_27_05_34-b00)
    OpenJDK 64-Bit Server VM (build 25.0-b70-fastdebug, mixed...