Page 1 of 1

NoClassDefFoundError: com/phidget22/Parity

Posted: Tue Dec 20, 2022 7:51 am
by dmccue128@gmail.com
I copied an example program from https://www.phidgets.com/?view=api, but I cannot get it to run:

Example code from method open():

import com.phidget22.*;

class Example {
public static void main(String[] args) {
try {
VoltageInput ch = new VoltageInput();
ch.open();

ch.close();
} catch (PhidgetException ex) {
System.out.println("Failure: " + ex);
}
}
}

Compiled on Ubuntu Linux 20.04.5 LTS using OpenJDK 1.8.0_352:
$ javac Example.java

When I run the program, it fails with NoClassDefFoundError: com/phidget22/Parity:
$ java Example -cp phidget22.jar
Couldn't FindClass com/phidget22/ParityException in thread "main" java.lang.NoClassDefFoundError: com/phidget22/Parity

It is true I cannot find this class in the src directory of the libphidgetjava build. What is wrong?

Is there a class, "Parity" or "ParityException"? I'm guessing my installation is corrupt somehow? Ideas?

Re: NoClassDefFoundError: com/phidget22/Parity

Posted: Wed Dec 21, 2022 4:02 pm
by Patrick
Your phidget22 C library and phidget22.jar are out of sync. Parity is an unused class which was renamed DataAdapterParity.

Update your installed libphidet22/libphidget22java.

-Patrick