Tuesday, January 21, 2014

MT4J Examples

Running the MT4J examples:

Make sure the 32bit JRE is run by default. You might have to uninstall any 64bit installations. Also, in the settings file, make sure the open GL renderer is the default configuration. Full screen settings etc. are also configurable there.

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.


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

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.

No comments:

Post a Comment