You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<ahref="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><imgclass="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
<p>The native libraries for all supported platforms are provided as JAR files which you can simply reference in your classpath. usb4java automatically determines on startup which libraries are needed for the current platform and extracts them to a temporary directory and loads them from there. This makes it easy to use usb4java because you just need to put the JARs into your classpath. No need to fiddle around with <i>java.library.path</i> or environment variables like <i>LD_LIBRARY_PATH</i> or <i>DYLD_LIBRARY_PATH</i>.</p>
<p>usb4java only extracts the files into a temporary directory when they are inside a JAR file. So if you prefer direct loading without extracting to a temporary directory then you may want to distribute the files in extracted form. Just make sure your classpath includes the directory where you have extracted the JARs. Here is an example application layout for this scenario:</p>
<p>If you get the second one then this simply means that your operating system is completely unknown to the usb4java authors and usb4java does not know the file extension of shared libraries on this platform. You can fix this by specifying a Java parameter like this (As explained in the exception):</p>
<p>After this you will most likely get the other exception, which means that there is no native JNI wrapper present for this platform. Your only chance here is to compile this wrapper yourself. I can't predict how this works on really strange platforms but chances are high that your platform is somewhat Unix-compatible. So try this:</p>
<p>1. Install a Java JDK (<aclass="externalLink" href="http://openjdk.java.net/">OpenJDK</a> for example). Make sure the environment variable <i>JAVA_HOME</i> is pointing to the directory where you have installed the JDK.</p>
<p>2. Install the <aclass="externalLink" href="http://libusb.info/">libusb</a> development files.</p>
<p>8. When compilation was successful then the native library can be found in the directory <i>/tmp/lib</i>. The file name depends on your operating system. Make sure you rename it to <i>libusb4java.so</i> (Or whatever file extension your platform uses) and copy this file into the directory <i>/org/usb4java/OS-ARCH/</i> in your classpath where <i>OS</i> is the name of your operating system and <i>ARCH</i> is your CPU architecture (Both must match the names mentioned in the exception thrown by usb4java.)</p>
<p>If you can't use the GNU compiler or cmake then you are on your own. If you have some experience with compiling JNI libraries then I guess this won't be hard for you. There are only a couple of source files in the <i>src</i> sub folder. You could write a new simple Makefile or whatever is needed on your platform.</p>
<p>If you have problems then please consult the <aclass="externalLink" href="mailto:usb4java@googlegroups.com">usb4java mailing list</a> (<aclass="externalLink" href="http://groups.google.com/group/usb4java">Google group</a>). You can subscribe to it via email by sending a mail to <aclass="externalLink" href="mailto:usb4java+subscribe@googlegroups.com">usb4java+subscribe@googlegroups.com</a>.</p></div>