Difference between revisions of "Robocode/Eclipse/Running from Eclipse"

From Robowiki
Jump to navigation Jump to search
(Added Category:Eclipse IDE)
(Undo changes meant for the Intellij wiki page.)
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{stub}}
 
 
 
Wondering how to run your robot in [[Robocode]] from [http://www.eclipse.org/ Eclipse]? Well this is possible! And that is what this page is all about.
 
Wondering how to run your robot in [[Robocode]] from [http://www.eclipse.org/ Eclipse]? Well this is possible! And that is what this page is all about.
  
Line 6: Line 4:
 
Right-click on your project, move the mouse-pointer down to '''Run As''' in the menu that opens and click '''Run...'''.
 
Right-click on your project, move the mouse-pointer down to '''Run As''' in the menu that opens and click '''Run...'''.
  
http://robocode.sourceforge.net/help/ide/runas.png
+
[[Image:Eclipse-RunAs.png|Shows how to start running a robot by right-clicking on the robot project, and then select "Run..." from the "Run As" item on the popup menu that occurs in Eclipse]]
 +
 
  
 
Now the following window will show up:
 
Now the following window will show up:
  
http://robocode.sourceforge.net/help/ide/run.png
+
[[Image:Eclipse-RunJavaApplication.png|Shows the Run dialog where the user must first press the "New" button, and then click "Java Application" to create a launch configuration for the robot]]
 +
 
  
 
Click on the '''Java Application''' on the left side, and afterwards the '''New''' button (New launch configuration).
 
Click on the '''Java Application''' on the left side, and afterwards the '''New''' button (New launch configuration).
Line 18: Line 18:
 
In the '''Main class''' field you must write '''robocode.Robocode''', which is the main class of [[Robocode]] used for playing the game.
 
In the '''Main class''' field you must write '''robocode.Robocode''', which is the main class of [[Robocode]] used for playing the game.
  
http://robocode.sourceforge.net/help/ide/run2.png
+
[[Image:Eclipse-RunConfigMain.png|Shows the Run dialog's run configuration details for the Main pane, where the name of the launch configuration must be typed in]]
 +
 
  
 
Next, you must click on the '''Arguments''' tab.
 
Next, you must click on the '''Arguments''' tab.
  
Here you write <code>-Xmx512M -Dsun.io.useCanonCaches=false</code> into the '''VM arguments''' text box. The <code>-Xmx512M</code> tells the Java VM that Robocode can use up to maximum 512 MB RAM off the heap, and <code>-Dsun.io.useCanonCaches=false</code> is a workaround to prevent SecurityExceptions to occur when robots try to access a file.
+
Here you write <code>-Xmx512M -Dsun.io.useCanonCaches=false -Ddebug=true</code> into the '''VM arguments''' text box. The <code>-Xmx512M</code> tells the Java VM that Robocode can use up to maximum 512 MB RAM off the heap, -Ddebug=true tells Robocode that it should not give you skipped turns just because you paused robot in debugger, and <code>-Dsun.io.useCanonCaches=false</code> is a workaround to prevent SecurityExceptions to occur when robots try to access a file.
  
 
Finally, you must click on the '''Other''' radio button under '''Working directory''', and then write the full path to the folder where [[Robocode]] is installed in the text file beside '''Other'''.
 
Finally, you must click on the '''Other''' radio button under '''Working directory''', and then write the full path to the folder where [[Robocode]] is installed in the text file beside '''Other'''.
  
http://robocode.sourceforge.net/help/ide/run3.png
+
[[Image:Eclipse-RunConfigArguments.png|Shows the Run dialog's run configuration details for the Arguments pane, where the text field path for "Other:" under "Working Directory" must be typed in]]
 +
 
  
 
Now you press "Run", and Robocode will (hopefully) start up. In Robocode you start your robot by selecting Battle->New from the menu or by using the hotkey Ctrl+N. Next, you select your robot and some other opponent robots, and press "Start Battle".
 
Now you press "Run", and Robocode will (hopefully) start up. In Robocode you start your robot by selecting Battle->New from the menu or by using the hotkey Ctrl+N. Next, you select your robot and some other opponent robots, and press "Start Battle".
Line 32: Line 34:
 
The next time you want to run your robot(s) in Robocode from Eclipse, you simply run your launch configuration like this:
 
The next time you want to run your robot(s) in Robocode from Eclipse, you simply run your launch configuration like this:
  
http://robocode.sourceforge.net/help/ide/runmyrobots.png
+
[[Image:Eclipse-RunMyRobots.png|Shows the popup menu that occurs when the user selects the "run" button in Eclipse, where MyRobots launch configuration must be selected in order to run it]]
 +
 
  
 
An easier way is just to click on the "green play button" without the popup menu. This will start the last launch configuration automatically, which should be your project.
 
An easier way is just to click on the "green play button" without the popup menu. This will start the last launch configuration automatically, which should be your project.
  
== See Also ==
+
== References ==
 +
* [http://www.eclipse.org/ Eclipse.org - Eclipse home page]
 +
* [http://www.eclipse.org/downloads/ Eclipse Downloads]
 +
* [http://download.eclipse.org/eclipse/downloads/ Eclipse project downloads - latest releases]
 +
 
 +
== See also ==
 +
 
 +
=== Using Eclipse IDE ===
 +
* [[Robocode/Eclipse|Using Eclipse as IDE]]
 +
* [[Robocode/Eclipse/Create_a_Project|Creating a project for your robots]]
 +
* [[Robocode/Add_a_Robot_Project|Add robot project from an IDE into Robocode]]
 +
* [[Robocode/Eclipse/Create_a_Robot|Creating a robot in Eclipse]]
 +
* [[Robocode/Eclipse/Debugging Robot|Debugging your robot with Eclipse]]
 +
 
 +
=== Robot API ===
 +
* [http://robocode.sourceforge.net/docs/robocode/ Robot API]
 +
 
 +
=== Tutorials ===
 +
* [[Robocode/System Requirements|System Requirements for Robocode]]
 +
* [[Robocode/Download|How to download and install Robocode]]
 +
* [[Robocode/Robot Anatomy|The anatomy of a robot]]
 +
* [[Robocode/Getting Started|Getting started with Robocode]]
 +
* [[Robocode/My First Robot|My First Robot Tutorial]]
 +
* [[Robocode/Game Physics|Robocode Game Physics]]
 +
* [[Robocode/Scoring|Scoring in Robocode]]
 +
* [[Robocode/Robot Console|Using the robot console]]
 +
* [[Robocode/Downloading_Robots|Downloading other robots]]
 +
* [[Robocode/Learning from Robots|Learning from other robots]]
 +
* [[Robocode/Package Robot|Package your robot]]
 +
* [[Robocode/FAQ|Frequently Asked Questions (FAQ)]]
 +
* [[Robocode/Articles|Articles about Robocode]]
 +
* [[Robocode/Console Usage|Starting Robocode from the command line]]
 +
* [[Robocode/Graphical_Debugging|Graphical debugging]]
 +
 
 +
=== News and Releases ===
 +
* [http://sourceforge.net/export/rss2_project.php?group_id=37202 RSS Feeds for the Robocode project]
 +
* [http://sourceforge.net/project/showfiles.php?group_id=37202&package_id=29609 Robocode file releases]
 +
 
 +
=== Home pages ===
 +
* [http://robocode.sourceforge.net/ Classic homepage]
 +
* [http://sourceforge.net/projects/robocode Robocode project at SourceForge]
 +
* [http://robocoderepository.com/ Robocode Repository]
 +
* [[wikipedia:Robocode|Wikipediaentry for Robocode]]
  
 
[[Category:Robocode Documentation]]
 
[[Category:Robocode Documentation]]
 +
[[Category:Tutorials]]
 
[[Category:Eclipse IDE]]
 
[[Category:Eclipse IDE]]

Latest revision as of 22:28, 3 October 2023

Wondering how to run your robot in Robocode from Eclipse? Well this is possible! And that is what this page is all about.

Running your robot from Eclipse

Right-click on your project, move the mouse-pointer down to Run As in the menu that opens and click Run....

Shows how to start running a robot by right-clicking on the robot project, and then select "Run..." from the "Run As" item on the popup menu that occurs in Eclipse


Now the following window will show up:

Shows the Run dialog where the user must first press the "New" button, and then click "Java Application" to create a launch configuration for the robot


Click on the Java Application on the left side, and afterwards the New button (New launch configuration).

Now you should change the name of your launch configuration to something you remember, e.g. MyRobots - Robocode.

In the Main class field you must write robocode.Robocode, which is the main class of Robocode used for playing the game.

Shows the Run dialog's run configuration details for the Main pane, where the name of the launch configuration must be typed in


Next, you must click on the Arguments tab.

Here you write -Xmx512M -Dsun.io.useCanonCaches=false -Ddebug=true into the VM arguments text box. The -Xmx512M tells the Java VM that Robocode can use up to maximum 512 MB RAM off the heap, -Ddebug=true tells Robocode that it should not give you skipped turns just because you paused robot in debugger, and -Dsun.io.useCanonCaches=false is a workaround to prevent SecurityExceptions to occur when robots try to access a file.

Finally, you must click on the Other radio button under Working directory, and then write the full path to the folder where Robocode is installed in the text file beside Other.

Shows the Run dialog's run configuration details for the Arguments pane, where the text field path for "Other:" under "Working Directory" must be typed in


Now you press "Run", and Robocode will (hopefully) start up. In Robocode you start your robot by selecting Battle->New from the menu or by using the hotkey Ctrl+N. Next, you select your robot and some other opponent robots, and press "Start Battle".

The next time you want to run your robot(s) in Robocode from Eclipse, you simply run your launch configuration like this:

Shows the popup menu that occurs when the user selects the "run" button in Eclipse, where MyRobots launch configuration must be selected in order to run it


An easier way is just to click on the "green play button" without the popup menu. This will start the last launch configuration automatically, which should be your project.

References

See also

Using Eclipse IDE

Robot API

Tutorials

News and Releases

Home pages