JMRI: Building with NetBeans
NetBeans 6.8 (available at www.netbeans.org) 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 MacOS X version of NetBeans 6.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 6.8 web site will be helpful.
Getting and installing Netbeans
- Download Netbeans 6.8 (The Java SE version is fine) from netbeans.org
- Run the netbeans package installer
Checking out code
The easiest way to get the initial copy of the code is to directly check it out using Netbean's integrated CVS. Once you've done that, NetBeans will automatically use it.
Start netbeans and do the following steps. Text in brackets [] are menu items to be selected
or buttons to be pressed.
Text in this font should be typed into NetBeans exactly as written.
This font denotes explanations and stage directions to follow.
- CVS Root: :pserver:anonymous@jmri.cvs.sourceforge.net:/cvsroot/jmri
- Password: leave empty
- [Next]
- Module: all (We really do mean to type "all" in the field. Don't leave the field blank!)
- Branch: leave empty
- Local Folder: pick somplace on your hard drive...
- [Finish]
[Window]->[Output]->[Output] shows cvs activity log window...
wait a few minutes for the CVS checkout to complete
A popup will display asking if you want to open the project
[YES]
Building and running JMRI
To build and run DecoderPro, all you have to do is select "Run Project (JMRI)" from the Run menu, or click the Run icon in the tool bar.
- Run -> Run Project (JMRI) will compile and invoke DecoderPro
- You can choose other targets (i.e. PanelPro...) by changing [File]->[Properties]->[Build and Run]->[Run Project]
If you want to run the program under the NetBeans debugger, select "Debug Project (JMRI)" from the "Run" menu.
Updating the code from CVS
From time to time, you can update the code to match the current repository contents. To do this, use the [Team]->[Update] menu choice.
Making a Jar File
Most of the code in a normal JMRI installation lives in a file called jmri.jar. If you want to replace this with your updated version, you need to create a new jmri.jar file from your modified code.
To do this,
ctrl-click (or right-click) on the name of the "JMRI" project in the
"Projects" window. This will open a pop-up menu, on which you'll
find "Make Jar File". Select that, and a new jmri.jar file will be
produced in the project's main directory.
Making a Patch File
A "diff patch file" is an easy way to gather up all your changes, even
if they span multiple files, into one file that you can then send to us.
It's also easy to merge in with the rest of the code, so we greatly
prefer that you use this.
To create the file:
- From the [Team] menu, select "Export Diff Patch ..."
- A file browser will open; enter a new file name in your preferred location and hit "Save" or "Open", depending on what the dialog shows.
- After it finishes calculating the diffs, the file you selected will contain the patches, along with an information header.
Windows Details
When running from within Netbeans on a Windows system, if JMRI can't find your layout connection this may be the problem. The problem is due to a different Java Runtime Environment (JRE) being used when run from within Netbeans as opposed to normal. Normally, the Windows installer deals with copying the necessary communications library files into the JRE - however, you'll need to do this manually in this instance. 1. from C:\Program Files\Java\jre1.7.0\lib\ext < Serialio.jar> into 'C:\Program Files\Java\jdk1.7.0\jre\lib\ext' 2. from C:\Program Files\Java\jre1.7.0\binand into 'C:\Program Files\Java\jdk1.7.0\jre\bin'