Clone wiki

fx-games / Setup_Eclipse


Download and install the latest version of Eclipse from:

Eclipse is distributed as a zip file, so to 'install' it all you have to do is unzip it somewhere. Once unzipped you can start eclipse by running eclipse.exe (or equivalent for your platform).

Note: many Eclipse users seem to like the m2eclipse plugin ( I am not an Eclipse user so cannot say if/how this is better than the default Eclipse Maven support. The steps below are done without this plugin.

Open the Project

The first time you start Eclipse you will be asked to select a workspace directory. You can use any directory you want, but it is easiest to use the directory where you cloned the fx-games code to using Mecurial (e.g. C:\dev\fxexperience\fx-games).

Once Eclipse opens choose File -> Import.

From the list of options choose Maven -> Existing Maven Projects

Choose the root directory of the defender project within fx-games that you previously cloned using Mecurial (e.g. your-dev-home\fx-games\defender).

Leave all other options as default and choose "Finish".

Eclipse will read the pom.xml in the defender directory and configure your Eclipse workspace appropriately. Any third party JARs used by the project will be automatically downloaded and added to the classpath.

Run the Project

Select Run -> Run.

The Defender application will launch automatically.

Editing and Source Control

In order to use Mecurial with Eclipse, you need to install an additional plugin.

Choose Help -> Install New Software"

Click the Add button to add a new repository. For the location use**.

In the tree, tick MecurialEclipse Stable Releases and then select Next for all steps.

Eclipse will download and install the plugin and then restart.

After restart, right-click the defender project in the Package Exlporer (tree on the left) and select Team -> Share Project. From the list of options choose Mecurial. Leave all other options as default.

From this point on, Eclipse will link your project with the Mecurial repository. Edit, add and delete files in your workspace as per normal. When you reach a logical check point in your changes you can "commit" using Team -> Commit. It is good practice to provide a short, meaningful message with your commit to let other developers know what you changed.

Committing does not push your changes to the server however, so to share your changes with the rest of the team you need to right-click on the defender project in the Package Explorer and select Team -> Push. All your subsequent commits will then be "pushed" to BitBucket and merged into the main codebase for the rest of the team to use. Use your BitBucket credentials when prompted.

To get the latest changes that other developers have made, right-click on the defender project and select Team -> Pull. All changes will be downloaded and merged into your local workspace.

For more information on using Mecurial in Eclipse see:

Maven Tips

You can edit code in the Maven project exactly as you would a normal project, but you should use the Maven directory structure conventions:

  • all Java code should be placed in src\main\java
  • all resources (images, fxml, stylesheets, etc) should be placed in src\main\resources

If you wish to add a third-party library to the project, you simply add the reference to the POM as a dependency. For example, to add the apache-io library to the project you would add the following:


The JAR will then be automatically downloaded and added to the classpath for you and all other developers when next they load the project.

To find dependencies available for download search:

For more general information on Maven see: