web stats

Guide to Setup Mirth 1.8.X as Eclipse Project

This guide for setting up Mirth 1.8 as an Eclipse project is based on the prior guide of a similar name for 1.7.X.

Required Software

To start the setup of eclipse project I'll assume you have installed and configured:

You can install the appropiate version of Subclipse from Eclipse. You should go to Help item in eclipse menu, "Software Updates", "Find and Install", "Search for new features to install", and define a new repository location. Provide the appropiate URL to you eclipse version (i.e. http://subclipse.tigris.org/update_1.2.x).  At the end of this process, eclipse should ask you about restart the application, answer yes.

Checkout the Sources

After you have restarted Eclipse with the Subclipse plugin (or if you have it already installed) follow these steps to create the new project:

  1. Go to "File" ? "New" ? "Other".
  2. Select a wizard
    1. Select "SVN" ? "Checkout Projects from SVN".
    2. Click "Next".
  3. Select/Create Location
    1. Select "Create a new repository location".
    2. Click "Next".
    3. Input "https://www.mirthproject.org/svn" into the "Url" field.
    4. Click "Next".
  4. Select Folder
    1. In the repository tree, select "tags/1.8.0".  Do not select anything under the "branches" or "trunk" nodes unless you have specific reasons for doing so.
    2. Click "Next".
  5. Check Out As
    1. Select "Check out as a project configured using the New Project Wizard".
    2. Enable "Check out HEAD revision".
    3. Click "Finish".
  6. Select a wizard
    1. Select "Java" ? "Java Project".
    2. Click "Next".
  7. Create a Java Project
    1. Type a name (e.g. "mirth") into the "Project name" field.
    2. If you have multiple JDKs installed on your system, select "Use a project specific JRE" and then select the JDK 1.5 JRE (e.g. "jdk 1.5.0_18") from the drop-down.  If it does not exist:
      1. Click the "Configure JREs..." hyperlink.
      2. Click "Search" and specify the directory that contains the JDK.
      3. After the search is complete, select the proper JRE.
      4. Click "OK".
    3. Click "Finish".

Grab a cup of coffee or a pint of your favorite IPA while Eclipse downloads Mirth.

Configure the Build Path

At this point, you should have a Java project with the sub-folders "client", "manager", and "server". Depending on the Eclipse Perspective you're using, you may also see folders for "src" and "JRE Systems Library".  To configure the project's build path:

  1. Add source folders for Mirth's Client, Manager, and Server:
    1. Right-click on the "client/src/" folder.
    2. Within the context menu, select "Build Path" ? "Use as Source Folder".
    3. Repeat 1a and 1b for each of the "manager/src/" and "server/src/" folders, ignoring all the red Xs at this time.
  2. You may safely remove the empty "src" folder because it's a Java project default unused by Mirth.
  3. Resolve the invalid library references (the red Xs):
    1. Right-click on the project, and select "Build Path" ? "Configure Build Path" from the context menu.
    2. Within the "Libraries" tab, click "Add JARs".
    3. Expand all folders (and subfolders) and select every JAR listed.  The easiest way to do this is to select all (Ctrl+A), and while holding Ctrl, click on each of the folders to deselect them.
    4. Click "OK" on the "JAR Selection" dialog.
    5. Click "OK".

A new folder will appear within the project tree called "Referenced Libraries".  Furthermore, no more red Xs should be visible, and the "Problems" tab at the bottom should not show any Errors (only Warnings, depending on your Compiler Errors/Warnings preferences within Eclipse).

Build Mirth Using Ant Within Eclipse

  1. Go to "Run" ? "External Tools" ? "External Tools Configurations".
  2. Right-click "Ant Build" and select "New".
  3. Enter a name into the "Name" field (i.e. "Build Mirth").
  4. Designate "mirth-build.xml" as the "Buildfile":
    1. Under the "Buildfile" field, click "Browse Workspace".
    2. Expand the project folder, select the "server" folder node, and then select "mirth-build.xml" from the adjacent pane.
    3. Click "OK".
  5. Designate the "server" folder as the "Base Directory":
    1. Under the "Base Directory" field, click "Browse Workspace".
    2. Expand the project folder and select the "server" folder node.
    3. Click "OK".
  6. If you have multiple JDKs installed on your system, you'll need to perform a few additional steps:
    1. Add "tools.jar" from the appropriate JDK (e.g. 1.5) to the classpath:
      1. Click the "Classpath" tab.
      2. Select "User Entries" ? "Ant Home (Default)".
      3. Click "Add External JARs".
      4. Navigate to the "lib" folder of the appropriate JDK and select "tools.jar".
    2. Tell Ant to run in the same JRE as the workspace:
      1. Click the "JRE" tab.
      2. Select "Run in the same JRE as the workspace".
  7. Click "Apply" to save the settings"
  8. Click "Run" to test the build.

Running the build should compile the whole project and generate the installers without problems. The installers (for Unix, OS/X, and Windows) will be created within the "server/setup/" folder.

Running and Debugging Mirth from Eclipse

  1. Go to "Run" ? "Run Configurations".
  2. Right-click "Java Application" and select "New".
  3. Enter a name into the "Name" field (i.e. "Mirth").
  4. Enter "com.webreach.mirth.server.Mirth" as the "Main class" (or "Search" for it).
  5. Designate the "server" folder as the working directory:
    1. Click the "Arguments" tab.
    2. Under the "Working directory" field, select "Other".
    3. Click "Workspace".
    4. Expand the project folder and select the "server" folder.
    5. Click "OK".
  6. Add the "conf" and "lib" folders to the classpath.
    1. Click the "Classpath" tab.
    2. Select "User Entries" and click "Advanced".
    3. Select "Add Folders" and click "OK".
    4. Select the "server/conf/" folder and click "OK".
    5. Repeat 4a-4d for "server/lib".

Once the run configuration is defined, test that both Run and Debug works.

Enter labels to add to this page:
Please wait 
Tip: Looking for a label? Just start typing.
  1. Sep 15, 2009

    Alex Perez says:

    Hi, I'm susprised by the great improvement of this guide, since I published the...

    Hi,

    I'm susprised by the great improvement of this guide, since I published the 1.7.x version some time ago!! congratulations!

    But, I'm trying to follow this step by step, and I've not built a 1.8.1 version. I execute the ant task but the server/setup folder doesn't contain the installers ... In addition, when I run the Mirth server from eclipse, I have the "plugins" tab empty. I suspect that this may require compiling and then add the plugin's folder to the build-path .. I'm working on this at this point

  2. Feb 04, 2010

    Marcus Malcom says:

    Hi all, I was getting the following error with the above instructions: Action:...

    Hi all,

    I was getting the following error with the above instructions:

    Action: Creating a new channel after a newly built Mirth project 1.8.2 or trunk (2.0.0)

    Result:

    Error message - "You must have at least one source connector and one destination connector installed."

    To resolve this I had to do the following:

    1. Add server/build as a source directory in Eclipse
    2. Add the following directory to the Mirth run config's classpath under user entries
      1. server/setup/conf
      2. server/setup/lib
      3. Note: make sure these are after the Project Name (default classpath) - the channels will not load properly if you do not.

    Note: if you get the following after you try the above:

    Error: JAR resources in JNLP file are not signed by the same certificate

    Then just do a rebuild.

    --

    Marcus

  3. Mar 01, 2010

    Miguel Curi says:

    I am trying to get this to work on a MAC with OS X 10.6. I am looking at the fil...

    I am trying to get this to work on a MAC with OS X 10.6. I am looking at the file system and it appears that all versions of JDK (really just symbolic links with the names of different java versions) above 1.3 point to 1.6.0 so I don't have 1.5. Is that the version required for mirth 1.8.2? In any case, there is no tools.jar dir and the docs at the apple dev connection site say that those classes are part of the classes.jar package in OS X. The build completes successfully apparently but I am getting 10 error messages in eclipse that say something like:

    Access restriction: The type CachedRowSetImpl is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar DatabaseConnection.java /mirth/server/src/com/webreach/mirth/server/util line 123 Java Problem

    Is there a trick to get mirth on eclipse configured properly on the mac? If this is a problem with the jdk version, why is the build script output not showing these errors?

    Thanks for your help.

    Miguel.

  4. Jul 16

    John Newman says:

    following this guide for 1.8.0 and 1.8.2, I ran into a couple things. for 1.8.2...

    following this guide for 1.8.0 and 1.8.2, I ran into a couple things.

    for 1.8.2 only, I got a ton of compile errors, mostly element.setTextContent() is undefined.

    This was fixed by removing server/lib/jetty/xmlParserAPIs.jar from the build path.

    One more compile error, fixed by removing client/lib/extensions/dicomviewer/ij.jar from build path

    After I got rid of all the red X's, ran the ant build OK, but then debugging didn't load any of the plugins.

    Then Marcus's post above resolves that - I am not sure if you have to add server/build as a source folder, but I did anyway. You definately have to have setup/lib and setup/conf on the classpath for the connectors to load.