Search code examples
javaimportclasspathproperties-fileusb4java

Unresolved import of external library with properties file in classpath


I'm working with usb4java at the high level following this demo: http://usb4java.org/quickstart/javax-usb.html. My issue is that we need javax.usb.properties in the classpath, so I've put it in the src directory. I've also loaded up the .jars into a lib directory and added them to the referenced libraries. After all of this when importing "javax.usb.*" I'm getting an import cannot be resolved error and none of the types are accepted.

Note: the properties file is populated with: "javax.usb.services = org.usb4java.javax.Services" as instructed.

Thoughts?


Solution

  • I think you need to add to the CLASSPATH also the JSR080 (javax.usb API). Where the javax.usb interface is defined. You can download from here: http://javax-usb.sourceforge.net/

    I have checked and it looks the javax.usb API is included under lib folder in the usb4java-javax distribution: http://nexus.ailis.de/content/groups/public/org/usb4java/usb4java-javax/1.2.0/usb4java-javax-1.2.0.zip it is called usb-api.jar

    Then make sure the javax.usb.properties file is on the root of your application CLASSPATH.