Here is a quick get-on-your feet with Robocode setup.
- Eclipse is installed.
- Robocode is installed in c:\robocode.
- Your bot is named police.Robocop.
- Your source code is in f:\source. (main class file is thus f:\source\police\Robocop.java)
- Start Eclipse.
- When prompted for the workspace, use 'c:\workspaces\Robocode Workspace' or some preferred path.
- Close the introductory window.
- Select menu option File | New | Project
- Ensure Java Project is highlighted and click Next.
- Choose a project name, such as 'Robocode Project' or 'Robocop'. You may want other projects later for other bots or to isolate testing, etc.
- Click Next.
- On the 'Source' tab, in the upper right there is an icon with a tooltip that reads 'Link Additional Source to Project'. Click it.
- Browse to f:\source. Click OK.
- Leave the folder name as is or rename it, as you prefer. It will appear as an expandable entry under the project name, and your packages (e.g. police) will we expandable entries under it.
- Click OK.
- With your source file name highlighted on the 'Source' tab window, find the 'Default Output Folder:' section at the bottom and click 'Browse'.
- Click 'Create New Folder'. Click 'Advanced' Checkmark the 'Link to a folder in the file sytetm' option. Click 'Browse'.
- Navigate to c:\robocode\robots. Click OK.
- Enter a name in the 'Folder Name:' field, such as 'output'. Click OK. Click OK.
- Select the 'Libraries' tab.
- Click 'Add External JAR's...'.
- Navigate to c:\robocode. Select 'robocode.jar'. Click 'Open'.
- Click Finish.
- Select menu option Project | Build Automatically (if it isn't already checkmarked).
You are ready to go.
This example follows my setup where I have Robocode installed at both home and work on different drive letters, workspaces and projects at home and work, and the source code on a 256 meg USB drive. I tried putting everything on the USB drive but the speed of Robocode extracting robots and rebuilding its database was inadequate. The drive letters are different for my USB drive and Robocode istallation at home and work, so this setup is the only way to address my situation.
With this setup your code will be compiled right into Robocode's robot directory every time you save a file. The next battle you start will use the latest code. If you add a new robot class while Robocode is running you will need to refresh Robocode's robot listing, as usual. (Same goes for dropping in other folk's jar files on the fly.)
You may be able to figgure out how to build JAR files on the fly, but I just use Robocode's built-in feature for that, and I don't have to worry about including source by mistake because the source code never makes it to Robocode's robots directory .. only the compiled class files.
-- Martin Alan Pedersen / Ugluk