Software documentation

Development tools


Techniques and Standards

How To

Functional Info

Background Info

JMRI: Building with NetBeans

See Also


NetBeans 8 (available at makes a great platform for working with JMRI. The JMRI code is setup to work with NetBeans with almost no additional setup. (The description below is accurate for the Windows version of NetBeans 8. NetBeans is supposed to be identical across platforms, but this hasn't been checked on anything else).

NetBeans is a very powerful Integrated Development Environment (IDE), which can make working with the JMRI code pretty easy. But it takes a little getting used to, and reading the tutorials on the NetBeans web site will be helpful.

Getting and Installing NetBeans

Many Linux distributions have NetBeans available in their software repositories - search your package manager for NetBeans.

Important note for Windows users

Due to different handling of Line Endings characters (LF / CR LF) between Windows and other systems - namely Unix and OS X (see Handling Line Ends) - it is of the utmost importance that all Windows users adopt the following settings for their development environment. This is absolutely required so that Git can track individual changes on files that you commit.

If you don't follow these instructions, you'll mess up the line endings in the files you commit, which will in turn make their revision history much harder to access. Files in this condition will not be accepted as pull requests.

As a first step, as JMRI has adopted LF as a convention for Line Endings, it is required to set the core.autocrlf setting to true (see "Dealing with line endings" on GitHub Help)

Additional important note for Netbeans Windows users

Moreover, if you are using NetBeans on Windows, you must install the "Change Line Endings on Save" plugin before using Git via NetBeans.

Please install the plug-in to make sure that NetBeans properly maintains the LF characters at the ends of source-code lines.

Actually the plug-in is already available in the NetBeans distribution, so go to Tools > Plugins > Available Plugins and there select Change Line Endings on Save and then Install.

You can check that the plug-in is properly installed by going to go to Tools > Plugins > Installed, where you should see something like this (versions might differ):

Once the plug-in has been installed and activated, it is necessary to configure it for the desired line ending character(s), via the Tools > Options > Editor > Line Endings tab.

For JMRI, we want to use the Unix-style line ending character, LF.

The plug-in may be enabled via a button in the toolbar.

And the plug-in may be disabled via that button.

When a file is saved (assuming the the plug-in is configured and is enabled) and that file has line-endings which do not match the type configured for the plug-in, the following message pops up.

When "OK" is selected, the plug-in updates the line-endings to the configured form and saves the file. If "CANCEL" is selected, the file will be saved WITHOUT changing any line-endings.

Using NetBeans with JMRI's Git Code Repository

GitHub provides JMRI's code repository using the Git tool. For more information on how JMRI uses Git, see the JMRI Help on Getting the code via Git and Git FAQ.

Once set up, NetBeans provides built-in support for using Git.

For more information on Git and NetBeans, see the NetBeans Git help page

Checking out code