This short tutorial explains how to run the examples contained in the MT4j full release from within the Eclipse IDE. If you need help installing MT4j into Eclipse, take a look at the installation instructions first.

Step 1: Open the Package Explorer

After importing MT4j into Eclipse, click on the "Package Exloprer" tab on the left side. You should now see the MT4j project on the list.

Step 2: Select the Example

Expand the MT4j project and open the "examples" folder. You should now see something like this.

StartExamples3_cr2

This is a list of all the java packages of the examples. Now you can choose which example you want to launch. The examples are divided into the "basic" and "advanced" packages. To launch the MT-Shell example, open the package "advanced.mtShell". It contains the java class "StartMTShell.java". You have to launch this class to run the example. If you want to run another example, try the other packages, like "advanced.fluidsimulator" for example. The name of the java classes that you have to launch in order to run the example all start with "Start.." to make them easy to recognize (e.g. "StartWaterScene.java", "StartMapsExample.java", "StartMTShell.java", etc)

Step 3: Run the Example

To start an example, right click on the example's starting class (e.g. "StartMTShell.java"). From the context menu select "Run As ->" and then select "Java Application".


StartExamples4 cr2.png

Some MT4j examples (e.g. Maps or MTShell, which contains the Maps example) require more memory than granted by default. By default, the java runtime allows an application to use up to 64MB of RAM. If this limit is exceeded, the out of memory error is thrown. To allow such examples to use more memory, go to menu "Run" -> "Run configurations/Open Run Dialog..". Select the example's starting class (e.g. "StartMTShell.java") on the left. Now go to "Arguments" tab -> "VMArguments" and write "-Xmx512m" into the VMArguments text area. Press "Apply" button to complete. Finally, press "Run" button to start the example. You can reuse the run configuration you created if you want to start the example later again.

RunConfigurationEclipse.jpg

Powered by MediaWiki contact