javac package com.phidget22 does not exist

Supporting Java SE version 7 and up
DarylL
Fresh meat
Posts: 3
Joined: Fri Apr 24, 2020 9:34 am
Contact:

javac package com.phidget22 does not exist

Postby DarylL » Fri Apr 24, 2020 9:56 am

I am followint the guidelines for compiling my program in java, but keep getting the error message that package com.phidget22 does not exist

- my app, as well as phidgets22.jar are located in the same folder
- When I use the command 'java -classpath .:phidget22.jar Train.java' I get an error message stating " package com.phidget22 does not exist
import com.phidget22.*;"
- When I use the command 'java -classpath .:phidget21.jar Train.java' I get an error message stating " Could not find or load main class Train.java"

here is my code (please note that I have had to replace . in two places with (dot):

Code: Select all

import com.phidget22.*;
import java.util.Scanner; //Required for Text Input
import java(dot)io.IOException;

public class Train{

   public static void main(String[] args) throws Exception {
      VoltageInput voltageInput0 = new VoltageInput();
      DigitalOutput digitalOutput0 = new DigitalOutput();

      voltageInput0.addVoltageChangeListener(new VoltageInputVoltageChangeListener() {
         public void onVoltageChange(VoltageInputVoltageChangeEvent e) {
            channel = digitalOutput0.getChannel();
            if (channel == 0){
               if (str(voltage) < "2.5"){
                  if (digitalOutput0.getDutyCycle() == 0);
                     digitalOutput0.setDutyCycle(1);
            } else {
//      #               print("voltage: " + str(voltage))
//      #               print("DutyCycle: " + str(digitalOutput0.getDutyCycle()))
                     digitalOutput0.setDutyCycle(0);
            }
            }
         }
      });

      voltageInput0.open(5000);
      digitalOutput0.open(5000);

      digitalOutput0.setDutyCycle(1);

      //Wait until Enter has been pressed before exiting
      System(dot)in.read();

      voltageInput0.close();
      digitalOutput0.close();
   }
}

DarylL
Fresh meat
Posts: 3
Joined: Fri Apr 24, 2020 9:34 am
Contact:

Re: javac package com.phidget22 does not exist

Postby DarylL » Fri Apr 24, 2020 4:33 pm

Found my problem... was using the wrong JDK. Thanks to your guides for helping me fix it. :D


Return to “Java”

Who is online

Users browsing this forum: No registered users and 1 guest