Skip to content

Tutorial: Creating a Module in Eclipse

TheCrownedFox edited this page Jun 13, 2013 · 10 revisions

Creating a module in Eclipse

  1. Download the most recent version of the SDK and save it.

  2. Create a new project in Eclipse:

    • File > New > Java Project
    • Enter a project name
    • Click Next
    • Click on the "Libraries" tab in the upper section of the screen
    • Click Add External JAR
      • Select the JAR you downloaded in step 1
    • Click Finish
  3. Create a new package:

    • Right click on your newly generated project on the Package Explorer pane and go New > Package
    • Enter in your module name
      • NOTE: this should be a unique identifier for your project so as to not conflict with any other modules, so we recommend using a qualified package name such as com.example.your_name
      • The naming conventions for packages vary but here is the Oracle recommendation
  4. Create a new class within that package that extends a module. For new users, we recommend creating a ProcessingModule.

    • Right click on your package from step 3
    • New > Class
    • Enter in a proper class name
    • In the superclass field, type the fully qualified name of the Module you are going to extend from. You can also use the browse tool. (an example is edu.mines.acmX.exhibit.module_management.modules.ProcessingModule)
    • Clear the checkbox to generate a main method (as the main method is in the SDK, your module won't need one)
    • Click Finish
  5. Create a manifest.xml file:

    • Right click on your project in the Package Explorer
    • New > File
    • Name your file "manifest.xml"
    • Click Finish
    • Copy the skeleton manifest text into your file
      • For an example manifest, see here
      • See here for more information about module manifests.
    • Edit the xml to reflect your module's package name, class name, author information, and title
      • NOTE: Double-check that your package and class name match your project, or your module will not load in the ModuleManager!
  6. Add an icon

    • Right click on your project in the Package Explorer
    • New > Folder
    • Name it "images"
      • NOTE: Any other image resources you want to use in your program need to be placed in this folder.
    • Copy in an image you would like to use. Make sure to update your manifest with the name of the image file (it should be similar to "icon.png", NOT "images/icon.png")
  7. Implement!

    • Depending on the Module type you are extending from, your approach will vary here. See Extending Modules for tutorials related to your specific module type.
  8. Test! Run your module within Eclipse for easy debugging, as explained here.

  9. Once your module is complete, export and run it with the Module Manager!

Clone this wiki locally