private static URL findLibraryResource ( final String libraryFileName ) { String osName = System . getProperty ( "os.name" ) . toLowerCase ( ) ; String osArch = System . getProperty ( "os.arch" ) . toLowerCase ( ) ; String resourceName = null ; LOG . trace ( "Load library \"{}\" for os {}:{}" , libraryFileName , osName , osArch ) ; if ( osName . startsWith ( OS_WIN ) ) { resourceName = determineWindowsLibrary ( libraryFileName , osName , osArch ) ; } else if ( osName . startsWith ( OS_LINUX ) ) { resourceName = determineLinuxLibrary ( libraryFileName , osName , osArch ) ; } else if ( osName . startsWith ( OS_FREEBSD ) ) { resourceName = determineFreebsdLibrary ( libraryFileName , osName , osArch ) ; } else if ( osName . startsWith ( OS_MAC ) ) { resourceName = determineMacLibrary ( libraryFileName ) ; } else { unsupportedPlatform ( osName , osArch ) ; } URL resource = NativeLoader . class . getResource ( resourceName ) ; if ( null == resource ) { unsupportedPlatform ( osName , osArch , resourceName ) ; } return resource ; }
Find the right shared library depending on the operating system and architecture .