Previous Next        Current Page: NeXtMidas User's Guide / Third-Party Compatibility / Eclipse
FAQs   
Release Information   
Getting Help   
Basic Concepts   
Result Parameters   
XML Support   
Files   
System Operation   
Macros   
Applets and WebStart   
Graphics   
X-Midas Interoperability   
Third-Party Compatibility   
   - Apache   
   + Web Browsers   
   - Java   
   + WebStart   
   - Profilers   
   - NetBeans   
   - Eclipse   
   - JBuilder   
   - Intel Fortran Compiler   
   - Portland Group Compiler   
   - SWIG   
   - VNC   
Installation and Customization   
Running NeXtMidas Independently   
Glossary   


Using Eclipse with NeXtMidas

This section explains how to configure the Eclipse IDE to run and debug NeXtMidas code.

  1. Getting Eclipse
  2. Initializing the Eclipse IDE
  3. Import a Project into Eclipse
  4. How-To Run NeXtMidas from inside Eclipse
  5. How-To Debug NeXtMidas code inside the Eclipse IDE
  6. How-To Run NeXtMidas from inside Eclipse (using nxm.sys.lib.NeXtMidas)
Note:
The following directions are for Eclipse 3.4. We recommend that users with earlier versions upgrade to version 3.4 or later.

Getting Eclipse

Eclipse is a "free and open source... integrated development environment for Java and C/C++ Software Developers" sponsored by IBM. Eclipse can be downloaded, free of charge:

    Eclipse IDE - http://www.eclipse.org/downloads

Back to Top

Initializing the Eclipse IDE


Note:
The default start-up configuration for the Eclipse IDE automatically deletes a critical NeXtMidas class file (NmClassLoader.class). This section describes the simple procedure for correcting this deletion.

  1. In the Eclipse IDE, select Project.
  2. Insure that the "Build Automatically" option is not selected. If it is checked then un-check it.

Back to Top

Importing a Project into Eclipse

The first step in running and debugging NeXtMidas in the Eclipse IDE is establishing a project. This is accomplished by importing the NeXtMidas installation directory as an existing project.

  1. In Eclipse, select File—>Import. This will open the Import pop-up. In the Import pop-up, select General—>Existing Projects into Workspace—>[Next>].


  2. The Import wizard will step to the next stage of the import process. In the Import pop-up, ensure that the "Select root directory" button is selected and click on [Browse].


  3. Navigate to the root directory were your project is installed then click on [Ok]. This will populate the Import wizard.


  4. Ensure that your project appears in the Import wizard "Projects:" area and that it is selected. Click on [Finish].

  5. Your project should appear in the Package Explorer panel on the left side of the Eclipse IDE. Select your project to verify that the expected directory structure exists.

Back to Top

How-To Run NeXtMidas from inside Eclipse

To run NeXtMidas from inside the Eclipse IDE you need to define a run configuration.

  1. In Eclipse, select Run—>Run Configurations... (under Eclispe 3.2, select Run—>Run....)
    This will open the Run Configurations wizard pop-up.
    In the Run Configurations pop-up, select Java Application,
    then select the "New launch configuration" icon on the top left of the command bar.


  2. The Run wizard will step to the next stage of the run configuration process.
    Type "nxm shellgui" in the Name: field.
  3. In the Main tab.
    Under Project: fill in nxm.
    Under Main class: fill in NmClassLoader


  4. In the Arguments tab.
    Under Program arguments: fill in -INDEPENDENT shellgui/attach.
    (Optional) -INDEPENDENT (or -I) run mode, it skips the USER nmstartup.mm in your HOME directory. If you want to run your nmstartup.mm, set the NMSTARTUP.USER system property, e.g.
    under VM arguments: add the following: -DNMSTARTUP.USER=nmstartup (see RuntimeOptions.txt for details on all supported macro syntax of the NMSTARTUP.USER system property).


  5. In the Classpath tab.
    Select User Entries—>[Advanced].


    In the Advanced Options pop-up select Add External Folder—>[OK].


    In the Folder Selection pop-up navigate to your $NMROOT/tools directory then select [OK].


    In the Classpath tab select the "nxm (default classpath)" entry then —>[Remove]
  6. In the Source tab.
    Select [Add].


    In the Add Source pop-up select Java Project—>[OK].


    Then in the Project Selection pop-up select nxm—>[OK].



    Click on [Apply] and your Run Configurations panel should look like this-


  7. When you select Run at the bottom of the Run Configurations panel you may get the following error-


    This is a minor error that can be ignored. This error will show up every time that you run this configuration. Select Always launch without asking to prevent the Errors in Workspace dialog box from coming up the next time that you run this configuration.

  8. Note:
    Older versions of the Eclipse IDE may delete the NmClassLoader.class file before you make the configuration changes mentioned in Initializing the Eclipse IDE. If this occurs you will see the following error in the Eclipse IDE Console tab.



  9. To repair the damage to the NeXtMidas installation caused by the Eclipse IDE Build Automatically setting, do the following:
    In a terminal window type nmstart (you will see the same Exception as described above).
    Then type nm make boot. This will remake the boot files for your installation thus remaking the NmClassLoader.class file.

  10. Finally, once all of the above errors have been addressed, you should see a NeXtMidas shell when the nxm shellgui run configuration is launched.

Back to Top

How-To Debug NeXtMidas code inside the Eclipse IDE

Follow these steps to use the Eclipse IDE to debug NeXtMidas code. For this example we will use the noop.java code.

  1. Select Window —> Show View —> Navigator to show the Navigator panel. In the Navigator panel navigate to nxm.sys.prim.noop.java. Double-click noop.java to open the source code in the Editor frame. Double-click on the grey break-point bar on the left side of the Editor frame to set/unset break-points.
    For this example we have set a break-point at rt = MA.getState("/RT"); [line 49] in the open() method.



  2. Select Run —> Debug Configurations. The Debug Configurations window will open. Select Java Application —> nxm shellgui —> [Debug].



  3. The GShell window will open with the NeXtMidas command line. Type noop apenny junk on the command line then hit [ENTER].



    The first time that you run the debugger the Confirm Perspective Switch pop-up dialog will open, select Remember my decision—>[Yes] to suppress this dialog from opening in the future.



  4. The Debug Perspective will open with the code stopped at the break-point that we defined in step 1.



    Follow standard debugging procedures from here.

Back to Top

How-To Run NeXtMidas from inside Eclipse (using nxm.sys.lib.NeXtMidas)

Since 2.9.0: To run NeXtMidas from inside the Eclipse IDE you need to define a run configuration.

  1. In Eclipse, select Run—>Run Configurations... (under Eclispe 3.2, select Run—>Run....)
    This will open the Run Configurations wizard pop-up.
    In the Run Configurations pop-up, select Java Application
    then select the "New launch configuration" icon on the top left of the command bar.

  2. The Run wizard will step to the next stage of the run configuration process. Type "NeXtMidas shellgui" in the Name: field.
  3. In the Main tab.
    Under Project: click browse and select the nxm project (or your option tree's project if it properly depends on the "nxm" project).
    Under Main class: fill in nxm.sys.lib.NeXtMidas

  4. In the Arguments tab.
    Under Program arguments: fill in -cmd=shellgui.
    See Running NeXtMidas directly in Java for list of all supported arguments (options).

    NOTE: the system-level and user-level startup macros are skipped in this run mode.
      To enable the SYS startup macro (prepend) -script=nxm.sys.cfg.nmstartup.mm
      To enable the USER startup macro (prepend just before -cmd=) -script=nxm.aux.home.nmstartup.mm
      e.g. the final program arguments will look like this:
      -script=nxm.sys.cfg.nmstartup.mm -script=nxm.aux.home.nmstartup.mm -cmd=shellgui

  5. In this run mode, the Classpath is determined by Eclipse so add any dependent option tree(s) under the Classpath tab.
    Click on the User Enteries,
    then ideally use Add Projects... and select appropriate projects.
  6. Then select the Run button to start NeXtMidas inside Eclipe.
  7. Debugging is similar to the steps outlined in the "How-To Debug..." section above.

Back to Top