StendhalNetBeans

From Arianne
Jump to: navigation, search



Notice

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

Creating a New Project

  1. Create a new Java project. Go to the menu bar and select "File -> New Project".
  2. In the New Project window Select "Java -> Java Application" and click "Next".
  3. Fill in the following information under "Name and Location":
  4. Project Name: stendhal (or whatever you want)
    Project Location: Choose the parent directory of your project.
    Uncheck "Create Main Class".
    
  5. Click "Finish".

Download Source from CVS

Updated for NetBeans 8.0

NOTE: NetBeans does not come with built-in CVS support. You will need to install the plugin.

Install CVS Plugin

  1. Go to the menu bar and select "Tools -> Plugins".
  2. Under the tab "Available Plugins" check "CVS" and click "Install".
  3. Restart NetBeans

CVS Checkout

  1. In the group window under the "Projects" tab select the project.
  2. From the menu bar select "Team -> CVS -> Import into Repository" or right-click the project and select "Versioning -> Import into CVS Repository".
  3. Fill in the following information under "CVS Root":
  4. For anonymous checkout:
      CVS Root: :pserver:anonymous@arianne.cvs.sourceforge.net:/cvsroot/arianne/stendhal
      Password: (leave blank)
    
    For privileged checkout:
      CVS Root: :ext:username@arianne.cvs.sourceforge.net:/cvsroot/arianne/stendhal
      Select "Use internal SSH".
      Password: (your Sourceforge password)
    
  5. Click "Next".
  6. Fill in the following information under "Folder to Import":
  7. Folder to Import: (the project's root directory)
    Import Message: (anything, cannot be left empty)
    Repository Folder: stendhal
    Check "Checkout After Import".
    
  8. Click "Finish" to begin import and checkout.
  9. After importing is finished go to the menu bar and select "Team -> Update -> Update" or right-click the project and select "CVS -> Update -> Update".

Skip to section labelled "Configure Project".

Download Source from Git

Incomplete...

  1. From the menu bar select "Team -> Git -> Clone".
  2. Fill in the following information:
  3. NOTE: While there are plans to move Stendhal from CVS to Git there is not yet an official Git repository. The following URIs are to testing repository which may not contain updated code. These will change once an official repository is available.

    Anonymous checkout:
      Repository: git://git.code.sf.net/p/delugebuilds/stendhal-git
    
    Privileged checkout:
      Repository: ssh://username@git.code.sf.net/p/delugebuilds/stendhal-git
      Password: Sourceforge password.
    

Configure Project

  1. Select the project in the "Project" tab of the groups window.
  2. Go to the menu bar and select "File -> Project Properties" or right-click the project and select "Properties.
  3. Select the "Sources" category in the left-hand pane.
  4. Fill in the following information:
  5. Source Package Folders:
      Package Folder = (the project's root folder)
      Label = (your choice)
    
  6. Select the "Libraries" category.
  7. Under the "Compile" tab click "Add JAR/Folder".
  8. Navigate into the "libs" directory of the project's root directory.
  9. Select all the .jar files and click "Open".
  10. Do the same for the "Processor", "Run", "Compile Tests", and "Run Tests" tabs.
  11. Select the "Run" category.
  12. Under "Configuration" click "New" and add a "Configuration Name" for the server and click "OK".
  13. Fill in the following information:
  14. Runtime Platform: Project Platform (should be Java 1.5 or greater)
    Main Class: games.stendhal.server.StendhalServer
    Arguments: Can be left blank.
    Working Directory: Can be left blank.
    VM Options: -Xmx128M
    
  15. Again under "Configuration" click "New" and add a "Configuration Name" for the client starter and click "OK".
  16. Fill in the following information:
  17. Runtime Platform: Project Platform
    Main Class: games.stendhal.client.update.Starter
    Arguments: Can be left blank.
    Working Directory: Can be left blank.
    VM Options: Can be left blank.
    
  18. Click "OK".

Running the Server

  1. From the menu bar select "Run -> Select Project Configuration -> <server configuration name>" (or select it from the drop-down menu in the tool bar).
  2. From the menu bar select "Run -> Run Project" or click the green arrow in the toolbar.
  3. On the server's first run you will be prompted to set the value of two options, the default database and an RSA key size. The default value for the database is "H2" and for the RSA key size is "512". Place your cursor in the display area of the Output tab in the lower half of the Netbeans window and press "Enter" to select the default values.


Running the Client

  1. Select the project configuration for the client as was done for the Server.
  2. From the menu bar select "Run -> Run Project" or click the green arrow in the toolbar.


Deprecated Instructions

Step 1: Create a NetBeans Project

First things first: We'll need a NetBeans project. To do this, go to File>New Project (or just click the new project button).

When the 'New Project' window opens, go ahead and select the 'General' category and the 'Java Application' project type.

You should see something like this:
<Note>:
You will probably see something different than what I have (you can get the C/C++ addon if you like but we won't be using it.). If you don't have either the 'General' category or the 'Java Application' type, do these things: If you used a .rpm or a .deb:
(1) Curse at yourself for using the Ubuntu .deb or an RPM from somewhere else
(3) Uninstall the .deb or rpm
(3) Download the *official* NetBeans package from http://www.netbeans.org/
</Note>
Now for the screenshot:
http://timothyb89.homelinux.org/wikipix/nb_new1.png
Now that that's done, go ahead and hit the Next button. Things to do
(1): Change the project name (I use 'Stendhal')
(2): (OPTIONAL) Change the project location
(3): Uncheck 'Create Main Class'<p> When you do those, you should have something like this: (you shouldn't have 'Project folder can not be created' as that should be filled in for you)
http://timothyb89.homelinux.org/wikipix/nb_new2.png


Step 2: Get Stendhal from CVS

You don't actually have to get anything from CVS, but I do reccomend it.
If you don't want to use CVS (or can't) you can always download and extract the source tarball from the SourceForge page and skip this step.
You way want to skip this step if you are using Windows as it usually doesn't have CVS installed.

Step 1: Open a terminal
There's so many ways to do this, so I'll try to use a generic way.

Linux:
Press the key combination ALT and F2. A run window should appear- type xterm or konsole (or gnome-terminal) in it and hit the enter key.

Windows:
Press the key combination WinKey and R. In the dialog that opens, type cmd and hit the enter key.

Step 2: Checkout Stendhal from CVS
Developers
You know how to do this. Make a new directory, set CVS_RSH to ssh, and checkout using ext instead of pserver.

Everyone else:
Run these commands:

  mkdir stendhal_temp
  cd stendhal_temp
  cvs -d:pserver:anonymous@arianne.cvs.sourceforge.net:/cvsroot/arianne login (password is empty; press return)
  cvs -z3 -d:pserver:anonymous@arianne.cvs.sourceforge.net:/cvsroot/arianne co -P stendhal

Step 3: Copy Stendhal Files into NetBeans Project

Y file and folder into your NetBeans project folder (probably ~/Stendhal or My Documents/Stendhal). First off: Open the stendhal folder found in the stendhal_temp folder we made earlier (if you didn't get CVS, use the directory you extracted your files to).
From there, copy EVERY file and folder into your NetBeans project folder (probably ~/Stendhal or My Documents/Stendhal).
You should replace the entire src folder and build.xml



Step 4: Finish configuring NetBeans (Approach 1)

Add Libraries
NetBeans will complain if we don't do this, so its best we get it done.<p>

From the 'Project' pane, right click on the 'Libraries' entry and choose 'Add Jar'.
In the browse dialog, browse to the libs folder found in the project folder. Choose a jar and click OK.
Repeat for all of the other jars.

http://timothyb89.homelinux.org/wikipix/nb_libs.png


Approach 2

Step 1: Get Netbeans Plugins

Get Maven Support
Follow the instructions from the IDE's help. (Extracted from Netbeans 6.0 Beta 1 Help)

The IDE's Plugins manager enables you to update your IDE's installed plugins dynamically. You can also use the Plugins manager to add new plugins and functionality to the IDE.

When you use the Plugins manager to update the IDE, the IDE checks the registered update centers to see if there are new plugins or new versions of already installed plugins available. If new or updated plugins are available, you can select, download, and install the plugins using the Plugins manager.

In addition to the default IDE Update Center, you can choose from several update centers that offer different types of plugins, such as experimental new plugins or old plugins that are no longer in regular distribution.

To update installed plugins from the Update Center:

  • Choose Tools > Plugins from the main menu to open the Plugins manager.
  • Click the Updates tab to display available updates of installed plugins.
  • In the left pane, select the plugins you wish to update and click Update.
  • Complete the pages in the installer to download and install the update.
  • The left pane of the Updates tab displays the installed plugins which have updates available from the update centers. By default, the IDE regularly checks the registered update centers for available updates of installed plugins. If no plugins are displayed in the left pane, it means that no updates were available the last time the IDE checked the update center.

To add new plugins from the Update Center:

  • Choose Tools > Plugins from the main menu to open the Plugins manager.
  • Click the Available Plugins tab to display plugins that are available but not installed.
  • In the left pane, select the plug ins you wish to add and click Install.
  • Complete the pages in the installer to download and install the plugin.

Notes: Some plugins may require you to restart the IDE to complete the update process.
You can set the frequency that the IDE checks for updates in the Settings tab of the Plugins manager. You can click Reload Catalog to check the update centers immediately.

Step 2: Checkout Stendhal from Netbeans using CVS

  • Choose Versioning > CVS > Checkout
  • Enter ':pserver:anonymous@arianne.cvs.sourceforge.net:/cvsroot/arianne' in the CVS root field.
  • Click next.
  • Click Browse in the Module section and select the stendhal folder from the pop up window.
  • Browse for a folder for the checkout. (If the wizard displays an error messages it means that the target folder doesn't exists and have to be created outside of Netbeans.
  • Click Finish.
  • When prompted to open a project from the checked out files click yes.

This will start the checkout process. It can take a while.

Step 3: Update Maven Repository (Optional)

If the project node has an exclamation symbol it means you are missing jar files in your Maven local repository.

If this is your case follow the next steps:

  • Right-click the project node from Netbeans Project tab.
  • Click 'Show and Resolve Problems...'.
  • Click 'Download Libraries'.

Step 4: Update Stendhal with CVS

In order to update your copy of Stendhal with the repository follow the next steps:

  • Right-click the project node from Netbeans Project tab.
  • Click CVS > Update with dependencies.

Your copy of Stendhal is updated after a while.

After any approach is completed...

Now NetBeans should be ready to work with Stendhal. The ant buildfile has been modified to work with NetBeans so you can:

  • Run the client (with the normal run- not the server as that would require too much configuration)
  • Build the client and server (with the normal NetBeans build)