How do you set up Karel J Robot in DrJava
You need to add two things to the classpath so that the Java Virtual Machine
will know where to find classes used in Karel J Robot.
If you have put all the Karel J Robot materials in a directory like c:\karel
then add the following to the classpath:
The jar file is a Java archive file. It holds several classes used by KarelJRobot
and is compressed to make it quicker to transmit via the internet and also it takes
up less space on your disk since it is compressed.
You need both because the KarelMain class is in kareltherobot package and is in
the karel directory. When you use classes in a package you need to add the level
above the package name to the classpath. So since KarelMain is in the package
kareltherobot it must be in the directory kareltherobot and the c:\karel
must be added to the classpath.
To do this click on Edit and then Preferences. Click on the Resource Locations if it isn't
highlighted and then the Add button. Add the items above. Then click on Apply and try to run
the main method in KarelMain. If you have trouble close DrJava and open it again and try again.
Link to this Page
- Questions last edited on 30 January 2006 at 1:29 pm by user-11216ng.dsl.mindspring.com