| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.nullprogram.guide.NativeGuide
public final class NativeGuide
This is a utility class for loading native libraries from the classpath. The JVM is unable to load libraries from inside .jar files. This class works around that by copying them out to a temporary directory on the filesystem. When using this utility class, imagine you are registering all versions of your native library. It would be used like this, for example,
NativeGuide.prepare(Arch.LINUX_32, "/x86/libexample.so"); NativeGuide.prepare(Arch.LINUX_64, "/amd64/libexample.so"); NativeGuide.prepare(Arch.WINDOWS_32, "/x86/example.dll"); NativeGuide.prepare(Arch.WINDOWS_64, "/amd64/example.dll");Libraries not used by the running architecture will be ignored.
| Method Summary | |
|---|---|
| static Arch | getArchitecture()Determine the JVM's native architecture. | 
| static void | load(Arch arch,
     String path)Load a native library resource by first copying it to a temporary directory. | 
| static void | load(String arch,
     String os,
     String path)Load a native library resource by first copying it to a temporary directory. | 
| static void | prepare(Arch arch,
        String path)Prepare a native library to be loaded by copying it to a temporary directory. | 
| static void | prepare(String arch,
        String os,
        String path)Prepare a native library to be loaded by copying it to a temporary directory. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Method Detail | 
|---|
public static void load(Arch arch,
                        String path)
                 throws IOException
arch - the architecture of the librarypath - the path to the library as a resource
IOException - if the library doesn't exist or could not load
public static void prepare(Arch arch,
                           String path)
                    throws IOException
arch - the architecture of the librarypath - the path to the library as a resource
IOException - if the library does not exist
public static void load(String arch,
                        String os,
                        String path)
                 throws IOException
arch - the os.arch stringos - the os.name stringpath - the path to the library as a resource
IOException - if the library doesn't exist or could not load
public static void prepare(String arch,
                           String os,
                           String path)
                    throws IOException
arch - the os.arch stringos - the os.name stringpath - the path to the library as a resource
IOException - if the library does not existpublic static Arch getArchitecture()
| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||