Compiling a Java USB program with unusual errors/warnings -
this question has answer here:
i developing usb reading java program name of attached usb device. code wrote:
import java.io.unsupportedencodingexception; import java.util.list; import javax.usb.*; import javax.usb.usbdevice; import javax.usb.usbdisconnectedexception; import javax.usb.usbexception; import javax.usb.usbhostmanager; import javax.usb.usbhub; import javax.usb.usbservices; public class listusbdevices { public static void main(string[] args) throws securityexception, usbexception, unsupportedencodingexception, usbdisconnectedexception { usbservices services = usbhostmanager.getusbservices(); usbhub roothub = services.getrootusbhub(); list<usbdevice> devices = roothub.getattachedusbdevices(); if (devices.size() > 0) { system.out.println("usb devices found."); } else { system.out.println("no usb devices found."); } (usbdevice device : devices) { system.out.println("\tproduct string " + device.getproductstring()); system.out.println("\tmanufacturer string " + device.getmanufacturerstring()); system.out.println("\tserial number " + device.getserialnumberstring()); } } }
when compile program, shows warning:
note: listusbdevices.java uses unchecked or unsafe operations. recompile -xlint:unchecked details.
i recompile -xlint:unchecked
, , shows this:
listusbdevices.java:21: warning: [unchecked] unchecked conversion found : java.util.l required: java.util.list<javax.usb.usbdevice> list<usbdevice> devices = roothub.getattachedusbdevices(); ^.
but class file created.
when run program, exception:
exception in thread "main" javax.usb.usbexception: properties file javax.usb.properties not found.
how solve problem? how set properties file in mac? had set classpath this:
export classpath=.:/users/sakkisetty/documents/jsr80-1.0.1.jar
but i'm not sure worked. pointers appreciated.
the properties file part of native package. wasn't aware of implementation osx.
an example of how set linux available @ javax.usb faq.
Comments
Post a Comment