cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

Working with the Open Sourced Javac Compiler

One of the open sourced JDK NetBeans projects provides the Javac Compiler. This project works with the source code for the Java programming language compiler, javac, which compiles Java source code into bytecode class files. In this tutorial, we build the Javac Compiler, and explore the other actions you can perform with these sources by means of its NetBeans project.

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

Setting up

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

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

Compiler in projects window

Building the Javac Compiler

To build the Javac Compiler sources, right-click the Javac Compiler 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

Running the Javac Compiler

Once you have built the compiler, you can run it in a number of ways.