Stendhal on Eclipse: Difference between revisions

From Arianne
Jump to navigation Jump to search
imported>Hendrik Brummermann
imported>Hendrik Brummermann
(No difference)

Revision as of 14:47, 1 March 2010

First Steps

  1. First of all open the view called Package Explorer.
  2. "New Project..."
  3. "CVS" -> "Project from CVS"
  4. Get stendhal from CVS. (Connection type: pserver, User: anonymous, Password - leave blank, Host:arianne.cvs.sourceforge.net, Repository: /cvsroot/arianne)
  5. file-> new -> project -> project-> from cvs
    click next
    
    check  "create new repository"
    click next
    
    host : arianne.cvs.sourceforge.net
    repository path : /cvsroot/arianne
    user : anonymous
    connection Type: pserver
    click next
    
    check "use an existing module"
    click directory: stendhal
    click next
    
    checkout as a project configured using the new project wizard
    click next
    
    click finish
    
    select a wizard: java project
    project Name: stendhal  ( or whatever you like to call it )
    make sure in jre a java version 1.5 or higher is selected
    click finish
    
  6. Make sure that the marauroa.ini (server.ini, for Stendhal version 0.63 or above) is in your stendhal project folder - only needed if you will be running the server or junit tests.
  7. Right click on your project folder and select "Properties" in the context menu.
  8. Then select "Java Build Path" on the left side of the dialog box.
  9. Now remove all existing folders from source path and add the two source folders 'src' and 'tests' by clicking on the "Add Folder..." button
  10. source folder #1:
              stendhal/src
                   Included:(All)
                   Excluded:(None)
                   Native library location: (None)
    
    source folder #2: 
              stendhal/tests
                   Included:(All)
                   Excluded:(None)
                   Native library location: (None)
    
    default output folder: stendhal/bin
    
  11. On the "Libraries" tab: click on the "Add JARs" button and select all the files in stendhal/lib

Eclipse should be able to compile the source code now. There could be a little yellow sign (signalling warning messages) before your project folder but there must not be red X (error messages). The package explorer should now display the "src" folder below the root folder with a different icon, the icon is like a small grid.

Trouble Shooting

menu Windows | Preferences | Java | Installed JREs

  • there should be at least one entry with a valid JAVA_HOME path (make it so so JDK compliance is 5.0  ?)

If you happen to get this: The method getLayerVector() is undefined for the type MapMapConverter.javastendhal/src/games/stendhal/toolsline 111

  • please right click your project folder again --> properties -> java build path.
  • in the [source] tab there should only be stendhal/src, so remove stendhal/tiled/src

(This entry has higher priority than the tiled.jar in the libs folder but this code is highly outdated)

To make it run the server in Debug mode

  • In the toolbar there is the "Debug" button, which looks like a little, green bug. There is a little black arrow on the right side of it.
  • This will open a menu, please choose "Debug configurations ..." ("Open Debug Dialog..." on older versions)
  • Then in the dialog select "Java Application" and click on the "new" icon in the top left corner.
 Name: StendhalServer
 Main class: marauroa.server.marauroad

* All other settings ("include system libries", "Stop in main", ... can be left at their default value.

on the [Arguments] tab:
Program arguments: -c server.ini -l  (optional)
VM arguments: -Xmx128M

on the [Classpath] tab:
 click UserEntries
 button "Advanced"
(*) add folder | OK
 and select the project root folder | OK
  • button [Debug]

And then the server should be started.

To make the client run

  1. Open games.stendhal.client.update.Starter.java in the editor
  2. Then again the small black arrow on the right side of the green bug. (Or you may also choose to use the "Run" command instead of "Debug" in case you only want to debug the server component.)
  3. Java Application -> new-icon, and it should be prefilled.
  4. On the [Classpath] tab - button "Advanced" - (*) add folder | OK - and select the project root folder. | OK

yay shiny new client, shiny server

Running JUnit Tests in Eclipse

  1. If you are runing JUnit tests in Eclipse, there are some additional things to be taken into account:
  2. Eclipse always automatically sets up a new run configuration for you if you invoke the "Run As" -> "JUnitTest" context command on a class or folder. It creates a default classpath configuration derived from the project settings in this run configurations. So there is missing the 'Stendhal' root folder in the classpath, which results in failures running some test cases. To fix this, open the run configurations and add the 'Stendhal' root folder like described above for the client configuration:
  3. On the [Classpath] tab - button "Advanced" - (*) add folder | OK - and select the project root folder. | OK
  4. After adding project-root to your classpath, Eclipse should automatically exclude the folders "src/" and "tests/". If not, exclude them together with "tools/" and "tiled/src/".