how_to_install_the_library_in_bluej
Installing an External Library in BlueJ with an external .jar file
- Make a New Project in BlueJ
- Click the
Libraries
Tab - Select the
kareljrobot.jar
file or other .jar file you downloaded, press theOpen
button - It will tell you to restart the Virtual Machine, press the
Okay
button - To test the APLU Turtle Library jturtle-0.1.1.jar, try this example program:
import ch.aplu.turtle.*; import java.awt.Color; /** * * @author (Your Name) * @version September 0, 2024 */ public class MyPicture { public static void main(String[] args) { Turtle hexter = new Turtle(Color.GREEN); hexter.setPos(100,-50); for (int i=0; i< 6; i++) { hexter.forward(100); hexter.right(-60); } hexter.setPos(0,0); hexter.setFillColor(Color.BLUE); hexter.fill(); Turtle t = new Turtle(hexter); t.setColor(Color.RED); t.setPos(-200, 180); t.hideTurtle().label( "by My name"); } }
- To test our the
kareljrobot.jar
installation, make a new classRobotRunner
to test it out:import kareltherobot.*; public class RobotRunner implements Directions { public static void main(String[] args) { World.setDelay(150); World.placeBeepers(4, 3, 2); World.setVisible(); } }
how_to_install_the_library_in_bluej.txt · Last modified: 2024/09/10 09:04 by frchris