Difference between revisions of "Robocode/Eclipse/Create a Project"

From Robowiki
Jump to navigation Jump to search
m (Spaces between images and text)
 
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
{{Youtube|3qOoDuGkwco|Creating an Eclipse Robocode Project}}
 +
 
In order to build a [[Robocode]] robot in [http://www.eclipse.org/ Eclipse], we first have to create a '''Project''' to store them in. This page will assist you in setting that up.
 
In order to build a [[Robocode]] robot in [http://www.eclipse.org/ Eclipse], we first have to create a '''Project''' to store them in. This page will assist you in setting that up.
  
Line 12: Line 14:
  
  
Type in a name for your project. I propose that we use the name '''MyRobots''' as the name for the new project. When you have written the name of the new project then click '''Next'''. <span style="color:red">''But do not click '''Finish''' yet!''</span>
+
Type in a name for your project. A project can contain just one robot or many robots, so choose a name to suit your plans. Here we use the name '''MyRobots''' as the name for the new project. When you have written the name of the new project then click '''Next'''. <span style="color:red">''But do not click '''Finish''' yet!''</span>
  
 +
[[Image:Eclipse-NewJavaProject.png|Shows a dialog for creating a new Java project where the user must type in a name for the new project]]
  
[[Image:Eclipse-NewJavaProject.png|Shows a dialog for creating a new Java project where the user must type in a name for the new project]]
 
  
 
=== Oops! I clicked '''Finish'''. What to do? ===
 
=== Oops! I clicked '''Finish'''. What to do? ===
 
If you clicked '''Finish''' by mistake, you can find the rest of the screens shown by right-clicking on the project named '''MyRobots''', then select '''Properties''', and then select '''Java Build Path'''.
 
If you clicked '''Finish''' by mistake, you can find the rest of the screens shown by right-clicking on the project named '''MyRobots''', then select '''Properties''', and then select '''Java Build Path'''.
+
 
 
== New Project ==
 
== New Project ==
 
Select the '''Libraries''' tab, then click on '''Add External JARs''':
 
Select the '''Libraries''' tab, then click on '''Add External JARs''':
  
[[Image:Eclipse-NewProjectAddExtJars.png|Shows that the "Libraries" tab must be selected and then the "Add External  
+
[[Image:Eclipse-NewProjectAddExtJars.png|Shows that the "Libraries" tab must be selected and then the "Add External Jars..." on the pane with Java Settings in the New Java Project dialog]]
  
  
Jars..." on the pane with Java Settings in the New Java Project dialog]]
+
Browse to the robocode directory, select the '''libs''' directory and then click the '''Open'''.
  
Browse to the robocode directory, select '''robocode.jar''' then click the '''Open'''.
+
[[Image:Eclipse-JarSelection.png|Shows the JAR Selection dialog where the user must first select the libs dir within the Robocode root dir and press the "Open" button]]
  
[[Image:Eclipse-JarSelection.png|Shows the JAR Selection dialog where the user must select the robocode.jar file and press the "Open" button]]
 
  
 +
Next, select the '''robocode.jar''' and then click the '''Open'''.
 +
 +
[[Image:Eclipse-JarSelection2.png|Shows the JAR Selection dialog where the user must secondly select the robocode.jar file within the libs dir and press the "Open" button]]
  
The window should now look like this. Make sure '''robocode.jar''' is selected.
 
  
 
Now you must select the '''Javadoc location: (None)''' under '''robocode.jar''' and click '''Edit...'''
 
Now you must select the '''Javadoc location: (None)''' under '''robocode.jar''' and click '''Edit...'''
  
http://robocode.sourceforge.net/help/ide/newproject5.png
+
[[Image:Eclipse-NewProjectEditJavadocLocation.png|Shows that the "Javadoc location: (None)" line under "robocode.jar" must be selected and then the "Edit..." in the New Java Project dialog]]
  
  
 
Type in (or browse to) the path for robocode.jar again. Optionally, enter the location of Robocode's Javadocs. The window should now look like this:
 
Type in (or browse to) the path for robocode.jar again. Optionally, enter the location of Robocode's Javadocs. The window should now look like this:
  
http://robocode.sourceforge.net/help/ide/newproject6.png
+
[[Image:Eclipse-RobocodeJavadocURL.png|Shows a dialog where the user must specify the URL of the Javadoc location path of Robocode]]
  
  
Line 49: Line 52:
 
Congratulations! Your new project is ready. :-)
 
Congratulations! Your new project is ready. :-)
  
== See Also ==
+
== Note about module-info.java ==
* [[Robocode/Using an IDE|Using Eclipse as IDE]]  
+
Please note that the newest versions of Eclipse will ask if you want to create a module-info.java file.
* [[Robocode/Eclipse/Create_a_Robot|Creating a Robot in Eclipse]]
+
If you get this question, you should select "Don't create".
* [[Robocode/Add a Robot Project|Adding your Robot Project to Robocode]]
+
 
 +
'''If you by mistake create a module-info.java, then you should make sure to delete it to avoid compiler and classpath issues.''' The module-info.java is not used for Robocode packages.
 +
 
 +
== 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/Add_a_Robot_Project|Add robot project from an IDE into Robocode]]
 +
* [[Robocode/Eclipse/Create_a_Robot|Creating a robot in Eclipse]]
 
* [[Robocode/Running from Eclipse|Running your robot from Eclipse]]
 
* [[Robocode/Running from Eclipse|Running your robot from Eclipse]]
 
* [[Robocode/Eclipse/Debugging Robot|Debugging your robot with 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 20:37, 29 May 2019

Youtube
Youtube has a video of Creating an Eclipse Robocode Project in action: click here to watch

In order to build a Robocode robot in Eclipse, we first have to create a Project to store them in. This page will assist you in setting that up.

Creating a Project for your Robots

First, select File->New->Project in the menu.

Shows how to select a new project from the File menu in Eclipse


In the New Project dialog, select Java Project then click Next.

Shows a dialog for creating a new project by selecting a wizard


Type in a name for your project. A project can contain just one robot or many robots, so choose a name to suit your plans. Here we use the name MyRobots as the name for the new project. When you have written the name of the new project then click Next. But do not click Finish yet!

Shows a dialog for creating a new Java project where the user must type in a name for the new project


Oops! I clicked Finish. What to do?

If you clicked Finish by mistake, you can find the rest of the screens shown by right-clicking on the project named MyRobots, then select Properties, and then select Java Build Path.

New Project

Select the Libraries tab, then click on Add External JARs:

Shows that the "Libraries" tab must be selected and then the "Add External Jars..." on the pane with Java Settings in the New Java Project dialog


Browse to the robocode directory, select the libs directory and then click the Open.

Shows the JAR Selection dialog where the user must first select the libs dir within the Robocode root dir and press the "Open" button


Next, select the robocode.jar and then click the Open.

Shows the JAR Selection dialog where the user must secondly select the robocode.jar file within the libs dir and press the "Open" button


Now you must select the Javadoc location: (None) under robocode.jar and click Edit...

Shows that the "Javadoc location: (None)" line under "robocode.jar" must be selected and then the "Edit..." in the New Java Project dialog


Type in (or browse to) the path for robocode.jar again. Optionally, enter the location of Robocode's Javadocs. The window should now look like this:

Shows a dialog where the user must specify the URL of the Javadoc location path of Robocode


Click OK, then click Finish to build your project.

Congratulations! Your new project is ready. :-)

Note about module-info.java

Please note that the newest versions of Eclipse will ask if you want to create a module-info.java file. If you get this question, you should select "Don't create".

If you by mistake create a module-info.java, then you should make sure to delete it to avoid compiler and classpath issues. The module-info.java is not used for Robocode packages.

References

See also

Using Eclipse IDE

Robot API

Tutorials

News and Releases

Home pages