Current Page:
NeXtMidas User's Guide
Third-Party Compatibility
Eclipse
|
|
Using Eclipse with NeXtMidas
This section explains how to configure the Eclipse IDE to run and debug
NeXtMidas code.
- Getting Eclipse
- Initializing the Eclipse IDE
- Import a Project into Eclipse
- How-To Run NeXtMidas from inside Eclipse
- How-To Debug NeXtMidas code inside the Eclipse IDE
- 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.
|
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
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.
|
- In the Eclipse IDE, select Project.
- Insure that the "Build Automatically" option is not selected. If it is
checked then un-check it.
Back to Top
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.
- In Eclipse, select File—>Import. This will open the Import
pop-up. In the Import pop-up, select General—>Existing Projects into
Workspace—>[Next>].

- The Import wizard will step to the next stage of the import process.
In the Import pop-up insure that the "Select root directory" button is
selected and click on [Browse]. Navigate to the root directory
were your project is installed then click on [Ok].This will
populate the Import wizard.

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

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
To run NeXtMidas from inside the Eclipse IDE you need to define a run configuration.
- 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.

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

- 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).

- 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]
- 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-

- 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.
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.

|
- 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.
- 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
Follow these steps to use the Eclipse IDE to debug NeXtMidas code. For this
example we will use the noop.java code.
- 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.

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

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.

-
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
Since 2.9.0: To run NeXtMidas from inside the Eclipse IDE you need to define a run configuration.
- 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.
- The Run wizard will step to the next stage of the run configuration process.
Type "NeXtMidas shellgui" in the Name: field.
- 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
- 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
- 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.
- Then select the Run button to start NeXtMidas inside Eclipe.
- Debugging is similar to the steps outlined in the "How-To Debug..." section above.
Back to Top
|
|
|