- 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();
}
}