Hi, I noticed that when I first ran Main.java, I received a java.lang.UnsatisfiedLinkError, which says it can't load dependency libraries when it was trying to load ftd2xxj.dll, as attached in the error stack below:
Dec 5, 2008 9:56:55 AM com.ftdichip.ftd2xx.ui.deviceTree.DevicesTreePanel$1 run
SEVERE: Failed to refresh device list.
java.lang.UnsatisfiedLinkError: E:\research\projects\Altera\Stratix IV GX\projects\usb controller\web applications\civetserver\jni\drivers\ftdi d2xx usb\ftd2xxj\ftd2xxj-2.1-src\lib\ftd2xxj.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.ftdichip.ftd2xx.Service.<clinit>(Service.java:101)
at com.ftdichip.ftd2xx.ui.deviceTree.DevicesTreeModel.createTree(DevicesTreeModel.java:50)
at com.ftdichip.ftd2xx.ui.deviceTree.DevicesTreeModel.refresh(DevicesTreeModel.java:41)
at com.ftdichip.ftd2xx.ui.deviceTree.DevicesTreePanel.refresh(DevicesTreePanel.java:126)
at com.ftdichip.ftd2xx.ui.deviceTree.DevicesTreePanel$1.run(DevicesTreePanel.java:94)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
I then used a dependency tool to find out what library the ftd2xxj.dll is dependent upon. I soon found out that it actually wraps ftd2xx.dll, which means it actually "depends" on this library.
This would mean that we should load this library (ftd2xx.dll) before we try to load ftd2xxj.dll. I added another line above the System.loadLibrary("ftd2xxj"), that tries to load ftd2xx.dll first, and the Main UI was brought up nicely. :)
System.loadLibrary("ftd2xx"); -- Line 100 of Service.java; this line should be added to load ftd2xx.dll before loading ftd2xxj.dll.
System.loadLibrary("ftd2xxj");
Hi Daniel,
your assumtions are correct. ftd2xxj is a wrapper for ftd2xx. When installed correctly ftd2xx.dll is found by Windows when ftd2xxj is loaded. Windows searches within the current working directory and the system folders. The ftd2xx driver must be installed correctly and all works fine.