Skip to Main Content U.S. Department of Energy

Creating a MIF Eclipse Project

A MIF project in Eclipse is a very lightweight layer on top of an Eclipse Java project. So, it will be familiear anyone who has used Eclipse to develop regular java code. The advantage to using a MIF project over a regular Java project is the added convenience of having the jars form the MIF lib/ directory automatically added to your project's classpath.

Prerequisites

Creating the project

Follow these steps to create a MIF project in Eclipse:

  • In the Eclipse menu, choose: File → New → Other
  • This brings up the “Select a wizard” dialog box. Filter the available choices by entering the word “mif” into the wizard filter box as pictured below

Select a wizard dialog

  • Choose the “Mif Project” wizard and click the “Next” button. This brings up the “New MIF Project” dialog, as pictured below

  • Fill out the following fields in the dialog
    • Project name: Enter the name of the project as it will appear in eclipse
    • Use default location: Leave this option checked to have the project installed into your workspace
    • MIF Home Directory: Choose the directory where MIF is installed on your machine
    • Include sample code: Check this option if you want to include the mif sample code in your project.
    • Generated Source Directory: This is the directory where source code generated by the component builder will be placed.

Using the new project

When the project has been created using the above steps, you will have a project that looks like the following in the eclipse package explorer window

Conventions and things to note in a MIF Eclipse project:

  • config directory: This is where configuration files should be placed in order for them to be on the MIF classpath and accessible to java code using a line such as:
getClass().getClassloader().getResourceAsStream(fileName)
  • src-gen directory: Code generated by the MIF component builder will be placed here (only applicable if you are using the component builder)
  • src directory: put all of your manually created classes in this directory
  • JRE System Library: this must point to a JVM of 1.6 or higher
  • Referenced Libraries: After the project is created, all of the MIF dependency jars appear here
 
create_a_mif_project_in_eclipse.txt · Last modified: 2010/09/25 11:11 by adamw