User Tools

Site Tools


how_to_install_the_library_in_eclipse

How to Install kareljrobot.jar in an Eclipse Project

  1. Go tho the workbench, Under the File menu, select New Java Project
  2. Give the project a name (for example Karel J Robot)
  3. In the JRE area, select use an execution environment JRE J2SE-1.5
  4. In the Project Layout area, select Use project folder as root for sources and class files
  5. Uncheck create module-info java file.
  6. Press the Finish button, even if you don't speak Finnish.
  7. Now right-click the new Project and select Preferences at the bottom (or press Alt-Enter or pressCommand-I on a mac or Control-I on Windows)
  8. Click once on the left to select Java Build Path
  9. Click once on the third tab called Libraries
  10. Click the second button down called Add External JARs
  11. Place the KarelJRobot.jar file you downloaded earlier into your new project folder (Do this using Finder on Mac or Files on Windows)
  12. Go back to eclipse and select the KarelJRobot.jar file you just dropped into the project folder.
  13. Press the Open button
  14. Press the Apply and Close button
  15. Make a new class RCRunner to test it out: From the File menu, select New → Class (or press the C+ button. ) and name class RCRunner. Paste the follwing code:
  import java.awt.Color;
  import kareltherobot.*;
  public class RCRunner implements Directions {
 
	// Main entry point
	public static void main(String[] args) {
	   World.setDelay(10); 
           World.placeBeepers(2, 1, 1);
           World.setVisible();
           RemoteControl karel = new RemoteControl(3, 1, East, 3 , Color.RED);
	}
}
how_to_install_the_library_in_eclipse.txt · Last modified: 2023/08/26 11:51 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki