Won't import wpilib libraries?

this is our code thus far. For whatever reason, it won’t let us import Victor, SimpleRobot, and rumble joysticks.

any help would be appreciated. Thanks.

/----------------------------------------------------------------------------/
/* Copyright © FIRST 2008. All Rights Reserved. /
/
Open Source Software - may be modified and shared by FRC teams. The code /
/
must be accompanied by the FIRST BSD license file in the root directory of /
/
the project. /
/
----------------------------------------------------------------------------*/

package org.usfirst.frc.team369.frisbeerobot;

import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpliibj.Joystick.RumbleType;
/**

  • The VM is configured to automatically run this class, and to call the

  • functions corresponding to each mode, as described in the SimpleRobot

  • documentation. If you change the name of this class or the package after

  • creating this project, you must also update the manifest file in the resource

  • directory.
    /
    public class RobotTemplate extends SimpleRobot {
    /
    *

    • This function is called once each time the robot enters autonomous mode.
      */
      Victor drive1;
      Victor drive2;
      Victor drive3;
      Victor drive4;
      Victor shooter1;
      Victor shooter2;
      Relay load;
      RobotDrive robot;
      Joystick joy1;
      Joystick joy2;
      Compressor airIntake;
      Solenoid degree1;
      Solenoid degree2;
      Solenoid shoot1;
      Solenoid shoot2;
      DriverStation ds;
      public RobotTemplate(){
      drive1 = new Victor(1);
      drive2 = new Victor(2);
      drive3 = new Victor(3);
      drive4 = new Victor(4);
      shooter1 = new Victor(5);
      shooter2 = new Victor(6);
      load = new Relay(1, 4);
      robot = new RobotDrive(drive1, drive2, drive3, drive4);
      joy1 = new Joystick(1);
      joy2 = new Joystick(2);
      airIntake = new Compressor(1, 1);
      degree1 = new Solenoid(1);
      degree2 = new Solenoid(2);
      shoot1 = new Solenoid(7);
      shoot2 = new Solenoid(8);
      ds = DriverStation.getInstance();
      airIntake.start();
      }

    public void autonomous() {

    }
    public void changeDegree(boolean deg){
    if(deg = true){
    degree1.set(true);
    degree2.set(false);
    }else if(deg = false){
    degree1.set(false);
    degree2.set(true);
    }
    }
    public void shoot(boolean sh){
    if(sh == true){
    shoot1.set(true);
    shoot2.set(false);
    }else if(false){
    shoot1.set(false);
    shoot2.set(true);
    }
    }

    /**

    • This function is called once each time the robot enters operator control.
      */
      public void operatorControl() {
      int count = 0;
      while(isOperatorControl()){
      Timer.delay(0.001);
      robot.tankDrive(joy1.getY(), joy2.getY());
      if(!ds.getDigitalIn(6)){
      changeDegree(true);
      }else if(!ds.getDigitalIn(8)){
      changeDegree(false);
      }
      if(!ds.getDigitalIn(1)){
      shooter1.set(1);
      shooter2.set(1);
      }else{
      shooter1.set(0);
      shooter2.set(0);
      }
      if(!ds.getDigitalIn(3)){
      shoot(true);
      }else{
      shoot(false);
      }
      if(!ds.getDigitalIn(5)){
      load.set(Relay.Value.kOn);
      }else{
      load.set(Relay.Value.kOff);
      }
      }
      }

    /**

    • This function is called once each time the robot enters test mode.
      */
      public void test() {

    }
    }

First off, when posting code please use code tags

 like this 

. Also, our team had the same problem. You have to tell Eclipse to use the JDK under “Installed JREs”. On some computers we also had to go to the project preferences and have wpilib checked, and we could never find out why on some and not all but it did end up fixing the problem. We also found out that in the future it helps to open one of the included example WPIlib projects and then reimport your code and that seemed to fix all errors with importing.

1 Like

I’m going to assume that you’re using Eclipse with the Robot Java Development plugin installed.

Is it that Eclipse isn’t allowing you to import them, or is it just that Eclipse can’t find them?

If it’s the latter then make sure the WPILib JARs are in the build path. Right click on your project in the Project Explorer, then click Properties… > Java Build Path > Libraries and see if the JAR files you need are there. It should look something like this: http://i.imgur.com/GI5WzH9

The WPILib JAR files should have been automatically installed to your home directory in wpilib/current/lib when you installed the Eclipse plugin.