using Ftd2xx library and javax.util.property-2_0 in applets
using Ftd2xx library and javax.util.property-2_0 in applets
Hi,
I am trying to communicate with the FTDI(Future technology devices Inc.) device using the dll provided by the FTDI. the dll is ftd2xx.dll
I am using ftd2xxj.dll provided by mike werner . this dll acted as a wrapper to the ftd2xx.dll.
This ftd2xxj.dll uses javax.util.property-2_0
Now the problem is :
When it is run as a main class, its runs nicely.
I just turned that main class into an applet, it started throwing error.
In applet, I gave the jar file of the code in the archive tag. and I also gave the javax.util.property-2_0.jar in the archive tag. But it shows some resource bundle not found or No class def found .
below is the applet tag :
<APPLET codebase=".\\jar" CODE="com.ftdichip.ftd2xx.ui.Main" ARCHIVE="javax.util.property-2_0.jar,Fluoroscent.jar" HEIGHT="200" WIDTH="200" ALIGN="bottom">This browser does not support Applets.</APPLET>
it gives the following exception if run in OC4J instance:
Finding devices
java.lang.ExceptionInInitializerError
at com.ftdichip.ftd2xx.ui.Main.init(Main.java:19)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.util.MissingResourceException: Can't find bundle for base name com.ftdichip.ftd2xx.Service, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at javax.util.Localizer.getResourceBundle(Localizer.java:191)
at javax.util.Localizer.getResourceBundle(Localizer.java:205)
at javax.util.Localizer.getLocalizedMessage(Localizer.java:156)
at javax.util.Localizer.getLocalizedMessage(Localizer.java:38)
at com.ftdichip.ftd2xx.Service.initializeProperties(Service.java:149)
at com.ftdichip.ftd2xx.Service.<clinit>(Service.java:105)
... 3 more
Caused by: java.lang.ClassCastException: com.ftdichip.ftd2xx.Service cannot be cast to ResourceBundle
at java.util.ResourceBundle$Control.newBundle(Unknown Source)
at java.util.ResourceBundle.loadBundle(Unknown Source)
at java.util.ResourceBundle.findBundle(Unknown Source)
at java.util.ResourceBundle.findBundle(Unknown Source)
at java.util.ResourceBundle.findBundle(Unknown Source)
... 11 more
and if run in applet viewer it gives the following:
Finding devices
java.lang.NoClassDefFoundError: javax/util/property/PropertyPersistenceManager
at com.ftdichip.ftd2xx.Service.initializeProperties(Service.java:147)
at com.ftdichip.ftd2xx.Service.<clinit>(Service.java:105)
at com.ftdichip.ftd2xx.ui.Main.init(Main.java:19)
at sun.applet.AppletPanel.run(AppletPanel.java:378)
at java.lang.Thread.run(Thread.java:595)
--
This exception was also thrown when I didnt place the javax.util.property file in the codebase. but after placing it, the exception changed.
here is the code of the main class :
package com.ftdichip.ftd2xx.ui;
import com.ftdichip.ftd2xx.Device;
import com.ftdichip.ftd2xx.DeviceDescriptor;
import com.ftdichip.ftd2xx.FTD2xxException;
import com.ftdichip.ftd2xx.Service;
import java.applet.Applet;
import java.awt.Graphics;
publicclass Mainextends Applet{
//public static void main(String [] args) {
publicvoid init(){
Device [] myDevices;
try{
System.out.println("Finding devices");
myDevices = Service.listDevices();
if (myDevices.length == 0){
System.out.println("Devices Not Found");
}
else{
for (int i = 0; i < myDevices.length ; i++){
System.out.println("Got Device" + myDevices[i]);
}
Device device = myDevices[0];
device.open();
DeviceDescriptor desc = device.getDeviceDescriptor();
System.out.println(desc.getManufacturer());
System.out.println(desc.getSerialNumber());
System.out.println(desc.getProductDescription());
char a2 = 10;
String commandStr ="PHOTO?"+Character.toString(a2);
byte [] command = commandStr.getBytes();
device.write(command);
Thread.sleep(500);
byte [] readBuffer =newbyte[50];
device.read(readBuffer);
System.out.println("Read Data : " +new String(readBuffer));
device.close();
}
}
catch (FTD2xxException fe){
System.out.println("FTDException Occured");
fe.printStackTrace();
}
catch (Exception e){
e.printStackTrace();
}
System.out.println("End of main");
}
publicvoid paint(Graphics g){
g.drawString("Saurabh",100,100);
}
}
-
I am totally stuck with this since last 3 days.. plz get me out of it....
Thanks
sd

