Discord Need help? Join our Discord community for support and questions

Robocode Quickstart

Get your first robot running in 5 minutes

Step 1: Install Java

Java 17 LTS or higher is required.

  1. Visit Oracle Java Downloads
  2. Download the Windows installer for Java 17 LTS
  3. Run the installer and accept defaults
  4. Open Command Prompt and run: java -version

Open Terminal and run:

sudo apt update sudo apt install openjdk-17-jdk -y

Verify with: java -version

Open Terminal and run:

brew install openjdk@17

Verify with: java -version

Step 2: Install Robocode

  1. Download robocode-1.10.0-setup.jar
  2. Save the file as robocode-1.10.0-setup.jar
  1. Double-click the JAR file to launch the installer
  2. If that doesn't work, open Command Prompt and navigate to where you downloaded the file
  3. Run: java -jar robocode-1.10.0-setup.jar
  4. Follow the wizard and choose your installation directory (e.g., C:\robocode)

Open Terminal and navigate to the download directory, then run:

java -jar robocode-1.10.0-setup.jar

Follow the wizard and choose an installation directory (e.g., ~/robocode)

  1. Double-click the JAR file to launch the installer
  2. Alternatively, open Terminal and run:
java -jar robocode-1.10.0-setup.jar

Follow the wizard and choose an installation directory (e.g., ~/robocode)

Launching Robocode

  1. Open File Explorer and navigate to your Robocode installation (e.g., C:\robocode)
  2. Double-click robocode.bat
  3. The Robocode GUI will open

Open Terminal and run:

cd ~/robocode ./robocode.sh

The Robocode GUI will open

Open Terminal and run:

cd ~/robocode ./robocode.sh

The Robocode GUI will open

Step 3: Write Your First Robot

  1. In Robocode, click Robot → Source Editor
  2. In the editor, click File → New → Robot
  3. Enter the robot name: MyFirstRobot
  4. Enter a package name: mypkg
  5. Replace all the generated code with:
package mypkg;

import robocode.*;

public class MyFirstRobot extends Robot {
    public void run() {
        while (true) {
            ahead(100);
            turnRight(90);
        }
    }

    public void onScannedRobot(ScannedRobotEvent e) {
        fire(1);
    }
}
Need help? Check the API Reference for all available robot methods and properties.
  1. Save and compile in the Editor: Compiler → Compile (or Ctrl+B)
  2. Wait for the message "Compiled successfully"
What it does: Your robot moves forward 100 pixels, turns right 90 degrees, and repeats. When it detects an enemy, it fires.

Step 4: Run Your First Battle

  1. In Robocode, click Battle → New
  2. Click the Robots tab
  3. In the left panel (Available Robots), find your package mypkg then find and double-click MyFirstRobot
  4. In package sample, find and double-click Tracker (a sample robot) to add it as your opponent
  5. You should see both robots listed in the right panel (Selected Robots)
  6. Click Start Battle
  7. Watch your robots battle! You can pause, resume, or adjust the speed
Congratulations! You've created and run your first Robocode robot. Now explore improving its strategy and competing against other robots.

Step 5: Package and Submit Your Robot

  1. In Robocode, click Robot → Package Robot
  2. Select mypkg from packages then find MyFirstRobot in Robots and click next
  3. Add a robot description (Required) and click next
  4. Choose the output path of the packaged robot jar file and click next
  5. Click Package! - this creates a .jar file
  6. You now have a packaged robot ready to submit
  7. Alternatively: You can also submit the .java file directly without packaging, but packaging is recommended for better compatibility
What's happening: Packaging creates a JAR file containing your compiled robot code, making it ready for distribution and submission.
Ready to compete? Submit your robot to Robocode Arena and watch it battle against other robots!

Learn More