From Arianne
Jump to: navigation, search


Most of our developers use Eclipse, so using that is recommended, unless you are an experienced Netbeans user.

Why another tutorial?

I know- there's already a tutorial for NetBeans, but it was written for older versions of NetBeans (namely, version 5.5). NetBeans 6 is considerably different and allows much easier configuration. Also, I'm trying to convert some over the other devels using Eclipse :)


To get started, you'll need NetBeans 6.0. There are a lot of milestones, betas, and release candidates out there for 6.0 (which stopped me from staying with Eclipse :) ), but since 6.0 final is out, I can't be sure they will work. Also, I'll be using the Full download (as in, the 169 MB download). If you did not get this, you may have to install the CVS plugin. See the IDE help for info on doing so.

All other libraries either come with NetBeans or with Stendhal, so you shouldn't have to worry about them.

Step 1: Getting the sources

If you want the "stable" code, head over SourceForge and download the latest Stendhal source distribution. Download this and extract it somewhere, ex. $HOME/Stendhal/source. (it must be in a subdirectory if you are OCD like me and like keeping random things organized). However, I recommend you get CVS as that is what I'm writing the tutorial from.

For those of you who have a need/want for the latest and greatest, CVS is the way to go. The IDE has built in CVS support, and should also include it in the distribution if you don't have it (not the case with Subversion).

First off, head over to the "Versioning" menu, go on to "CVS", and finally "Checkout...". You should find yourself staring at the checkout screen.

See below for filling in the details.

For developers:
CVS Root:
Password: Your password.
Everyone else:
CVS Root:
Password: Empty.

Click Next.

Now we need to choose the module to check out.
Simply fill in the following:
Module: stendhal
Branch: leave empty
Local folder: Enter a path to a directory on your system in which to place the Stendhal sources. For example, /home/me/Stendhal/source.

Click Finish to begin checking out the code/data. The progress will be displayed in the Output pane on the bottom of the main NetBeans indow. w

Creating a project

To create a new project, simply go to File>New Project. From there, choose a Java, and move on to Java Project with Existing Sources, and click Next.

You should now see the "Name and Location" panel. Fill in the following details:
Project Name: Can be anything; I'm using Stendhal.
Project Folder: Should be in the directory above your sources directory. If you used $HOME/Stendhal/sources, it should be something like $HOME/Stendhal/NetBeans

At this point, you should see panels for source and test folder entry.
In the Source Package Folders section, add /path/to/Stendhal/source/stendhal/src (replace the bold text with the location of your Stendhal directory).
In the Test Package Folders section, add /path/to/Stendhal/source/stendhal/tests (again, replace bold).
To complete the setup, click Finish.

Add Libraries

This could be the easiest step :)
First off, in the "Projects" pane, expand the new Stendhal project, right click on Libraries , and choose Add JAR/Folder....
Now, navigate to /path/to/Stendhal/source/stendhal/libs/ and, holding the Control or Shift key, select each jar and click Open.

Configure Project

The last step is to set up the project to run the code. I will go over setting up the IDE to run the client, but not the server. Though I'm not going over this, it is possible.
The first thing to do is right click on the new project in the Project pane, found on left of the main IDE window. From there, choose, choose Properties.
You should now see the project properties window. First, choose Libraries from the left, and then the Run tab in the main pane. From here, choose Add JAR/Folder and add your stendhal folder. For example, add /path/to/Stendhal/source/stendhal .

Now choose Run in the left menu again. Choose New, enter Client for the name, and fill in the following: (Any information not provided should be left empty)
* Main Class: games.stendhal.client.stendhal
* VM Options: -Xmx256m
Now you can simply click OK to finish.

Finish Setup

You should be done, so hit the run button on the main toolbar to start the client.