FeaturesPluginsDocs & SupportCommunityPartners

Working with the Open Sourced JMX Sources

The sources in the JMX project cover the Java Management Extensions (JMX) API, which is a standard Java API for management and monitoring of resources such as applications, devices, services, and the Java virtual machine. In this tutorial, we examine the JMX project in the IDE and learn what we can do with it.

When encountering problems of any kind, please consult the Troubleshooting Guide.

Setting up

Download and install the OpenJDK sources, and then open the JMX project, as explained in Getting Started with OpenJDK in NetBeans IDE.

Once you have opened the project, the Projects window should look as follows:

JMX in projects window

Building the JMX Sources

To build the JMX sources, right-click the JMX project in the Projects window and choose Build Project. The IDE runs the Ant script for the project and shows output in the Output window.

To view the build results, go to the Favorites window (Ctrl-3) and browse to the "j2se" folder. Once you have added the folder, you can see the newly created "build" and "dist" folders, the latter containing your build output, as shown in the following image:

javac project build outputs

Generating JMX Javadoc

When you want to access JMX programmatically, you can do so via the JMX API. Before you do so, you can generate the JMX Javadoc. Right-click the JMX project and choose Generate Javadoc for Project. The IDE's browser appears, displaying the generated Javadoc:

JConsole running

In the Favorites window (Ctrl-3), you can browse to the Javadoc files, which are generated to the j2se/build/${platform}/javadoc/jmx folder, as shown below:

Javadoc sources

Testing the JMX Sources

Set up the jtreg test framework, as explained in Getting Started with OpenJDK in NetBeans IDE.

Once you have set up jtreg, you can right-click a project in the IDE and choose Test Project. Alternatively, you can right-click an individual file and choose Run File. The latter runs a jtreg test on an individual file. jtreg prints summary output about the pass/fail nature of each test. HTML files with the results are written to the jtreg folder within the j2se/build folder.

JMX test window

For example, the errors.html file produces content such as the following:

JMX test window

Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by