User Tools

Site Tools


how_to_install_the_library_in_bluej

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
how_to_install_the_library_in_bluej [2019/08/15 18:31] frchrishow_to_install_the_library_in_bluej [2024/09/10 09:04] (current) frchris
Line 1: Line 1:
-====== Installing KarelJRobot.jar Library in Blue J ====== +====== Installing an External Library in BlueJ with an external .jar file ====== 
-  - Make a New Project +  - Make a New Project in BlueJ 
-  - Under ''Tools'', select ''Preferences''+  - Select ''Preferences'' (In MacOS it is under the 'BlueJmenu,in Windows it is under 'Tools){{::tools.png?300|}} 
   - Click the ''Libraries'' Tab   - Click the ''Libraries'' Tab
-  - Press the ''Add File'' button +  - Press the ''Add File'' button {{::librry.png}} 
-  - Select the ''kareljrobot.jar'' you downloaded, press the ''Open'' button+  - Select the ''kareljrobot.jar'' file or other .jar file you downloaded, press the ''Open'' button
   - It will tell you to restart the Virtual Machine, press the ''Okay'' button   - It will tell you to restart the Virtual Machine, press the ''Okay'' button
-  - Under the ''Tools'' menu select ''Reset Java Virtual Machine'' (or press **Ctrl-Shift-R**) +  - Under the ''Tools'' menu select ''Reset Java Virtual Machine'' (or press **Ctrl-Shift-R**){{::reset.png?400|}}  Sometimes it is best to simply Quit and relaunch BlueJ. 
-  - Make a new class ''RobotRunner'' to test it out: +  - To test the APLU Turtle Library {{ ::jturtle-0.1.1.jar |jturtle-0.1.1.jar}}, try this  example program:<code java> 
-<code java>+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");  
 +      
 +
 + 
 +
 +</code> 
 +  - To test our the ''kareljrobot.jar''installation, make a new class ''RobotRunner'' to test it out:<code java>
   import kareltherobot.*;   import kareltherobot.*;
   public class RobotRunner implements Directions   public class RobotRunner implements Directions
Line 19: Line 51:
  }  }
   }   }
-</code>+</code> 
how_to_install_the_library_in_bluej.1565908311.txt.gz · Last modified: 2019/08/15 18:31 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki