List of usage examples for java.lang System load
@CallerSensitive public static void load(String filename)
From source file:com.spotify.annoy.jni.base.AnnoyIndexImpl.java
AnnoyIndexImpl(int dim, Annoy.Metric angular) { this.dim = dim; System.load(Annoy.ANNOY_LIB_PATH); this.cppPtr = cppCtor(dim, angular.name().toLowerCase().charAt(0)); }
From source file:org.sipfoundry.openfire.sqa.SqaPlugin.java
@Override public void initializePlugin(PluginManager manager, File pluginDirectory) { try {//w w w . ja v a 2 s . c om String configurationPath = System.getProperty("conf.dir"); String libPath = System.getProperty("lib.dir"); String presence = System.getProperty("openfire.presence"); if (isBlank(configurationPath) || isBlank(libPath) || isBlank(presence)) { System.getProperties().load(new FileInputStream(new File("/tmp/sipx.properties"))); configurationPath = System.getProperty("conf.dir", "/etc/sipxpbx"); libPath = System.getProperty("lib.dir", "/lib"); presence = System.getProperty("openfire.presence", "true"); } UnfortunateLackOfSpringSupportFactory.initialize(); if (Boolean.valueOf(presence)) { System.load(libPath + "/libsqaclient.so"); SQAWatcher watcher = new SQAWatcher("openfire", "sswdata", 1, 100, 100); logger.info("Connected: " + watcher.isConnected()); JAXBContext context = JAXBContext.newInstance(DialogInfo.class); new SqaSubscriberThread(watcher, context, m_presenceCache).start(); PresenceEventDispatcher.addListener(new PresenceEventListenerImpl(m_presenceCache)); logger.info("SQA subscriber started..."); } else { logger.info("XMPP presence not enabled"); } } catch (SecurityException e) { logger.error(INITALIZATION_EXCEPTION, e); } catch (IllegalArgumentException e) { logger.error(INITALIZATION_EXCEPTION, e); } catch (FileNotFoundException e) { logger.error(INITALIZATION_EXCEPTION, e); } catch (IOException e) { logger.error(INITALIZATION_EXCEPTION, e); } catch (JAXBException e) { logger.error(INITALIZATION_EXCEPTION, e); } }
From source file:com.google.gdt.eclipse.designer.webkit.WebKitSupportWin32.java
private static void load() { String webkitDir = WEBKIT_DIR.getAbsolutePath() + File.separator; System.load(webkitDir + "icudt40.dll"); System.load(webkitDir + "icuuc40.dll"); System.load(webkitDir + "icuin40.dll"); System.load(webkitDir + "CFLite.dll"); System.load(webkitDir + "pthreadVC2.dll"); System.load(webkitDir + "JavaScriptCore.dll"); System.load(webkitDir + "libxml2.dll"); System.load(webkitDir + "libxslt.dll"); System.load(webkitDir + "cairo.dll"); System.load(webkitDir + "libcurl.dll"); System.load(webkitDir + "WebKit.dll"); }
From source file:by.zuyeu.deyestracker.core.util.OpenCVLibraryLoader.java
private void loadLibrary() throws DEyesTrackerException { LOG.info("loadLibrary() - start;"); try {/*from w w w . ja va2 s. c o m*/ final Properties properties = loadProperties(); final String rootPath = getRootPath(); InputStream in = null; File fileOut = null; final String osName = System.getProperty("os.name"); LOG.info("rootPath = {}, osName = {}", rootPath, osName); if (osName.startsWith("Windows")) { int bitness = Integer.parseInt(System.getProperty("sun.arch.data.model")); if (bitness == 32) { LOG.info("bit = {}", "32 bit detected"); in = new FileInputStream(new File(rootPath + properties.getProperty(OPENCVX86_JAVADLL))); fileOut = File.createTempFile("lib", ".dll"); } else if (bitness == 64) { LOG.info("bit = {}", "64 bit detected"); in = new FileInputStream(new File(rootPath + properties.getProperty(OPENCVX64_JAVADLL))); fileOut = File.createTempFile("lib", ".dll"); } else { LOG.info("bit = {}", "Unknown bit detected - trying with 32 bit"); in = new FileInputStream(new File(rootPath + properties.getProperty(OPENCVX86_JAVADLL))); fileOut = File.createTempFile("lib", ".dll"); } } else if (osName.equals("Mac OS X")) { in = new FileInputStream(new File(rootPath + properties.getProperty(OPENCVMAC_JAVADYLIB))); fileOut = File.createTempFile("lib", ".dylib"); } OutputStream out = FileUtils.openOutputStream(fileOut); IOUtils.copy(in, out); in.close(); out.close(); System.load(fileOut.toString()); } catch (NumberFormatException | IOException e) { LOG.error("loadLibrary", e); throw new DEyesTrackerException(DEyesTrackerExceptionCode.CORE_INIT_FAILURE, "Failed to load opencv native library", e); } LOG.info("loadLibrary() - end;"); }
From source file:us.ihmc.codecs.loader.OpenH264Downloader.java
private static synchronized void loadOpenH264(boolean showLicenseDialog) { if (openH264HasBeenLoaded) { return;/*from w w w . j a va 2 s.c o m*/ } String libraryName = getLibraryName(); File directory = new File(NativeLibraryLoader.LIBRARY_LOCATION); if (!directory.exists()) { directory.mkdirs(); } File library = new File(directory, getLibraryOnDiskName()); if (!library.exists()) { if (showLicenseDialog) { acceptLicense(); } downloadOpenH264(library, libraryName); } if (NativeLibraryLoader.isWindows()) { System.load(library.getAbsolutePath()); } openH264HasBeenLoaded = true; }
From source file:ml.dmlc.xgboost4j.java.NativeLibrary.java
private void extractAndLoad(String... libPaths) throws IOException { Throwable lastException = null; for (String libPath : libPaths) { try {/*from w ww .ja v a2 s . co m*/ lastException = null; File temp = extract(libPath, getClassLoader()); // Finally, load the library System.load(temp.getAbsolutePath()); // Perfect loaded, break the cycle logger.info("Loaded library from " + libPath + " (" + temp.getAbsolutePath() + ")"); break; } catch (IOException | UnsatisfiedLinkError e) { logger.warn("Cannot load library from path " + libPath); lastException = e; } } if (lastException != null) throw new IOException(lastException); }
From source file:org.mule.module.blink1.Blink1Module.java
@Start public void loadNativeLibrary() throws IOException { final String osName = System.getProperty("os.name"); final String osArch = System.getProperty("os.arch"); final String nativeLibraryPath = selectNativeLibrary(osName, osArch); LOGGER.info("Loading native blink(1) library: " + nativeLibraryPath); // extract the blink library file relevant for the OS / architecture final File library = File.createTempFile("blink1.", ".lib"); library.deleteOnExit();//from w w w. ja v a 2 s. c o m final FileOutputStream fos = new FileOutputStream(library); IOUtils.copy( Thread.currentThread().getContextClassLoader().getResourceAsStream("native/" + nativeLibraryPath), fos); IOUtils.closeQuietly(fos); // load the blink library try { System.load(library.getAbsolutePath()); } catch (final Throwable t) { throw new RuntimeException("Failed to load native library: " + nativeLibraryPath + " for environment: " + osName + " - " + osArch + " " + PROJECT_ISSUES_MESSAGE, t); } blink1 = new Blink1(); }
From source file:org.polymap.p4.data.importer.ogr.SqliteOgrImporter.java
@Override public void verify(IProgressMonitor monitor) { try {/*from www . j a v a 2s. c om*/ // translate to json monitor.beginTask("Verify", 3); File temp = SqliteOgrTransformer.translate(f, new SubMonitor(monitor, 1)); monitor.subTask("opening temp spatialite database"); System.load("/home/falko/servers/spatialite-libs/libgeos-3.1.1.so"); System.load("/home/falko/servers/spatialite-libs/libgeos_c.so.1.6.0"); System.load("/home/falko/servers/spatialite-libs/libproj.so.0.5.5"); Map<String, Object> params = new HashMap(); params.put("dbtype" /*SpatiaLiteDataStoreFactory.DBTYPE.key*/, "spatiali te" /*SpatiaLiteDataStoreFactory.DBTYPE.sample*/ ); params.put("database" /*SpatiaLiteDataStoreFactory.DATABASE.key*/, temp.getAbsolutePath()); ds = DataStoreFinder.getDataStore(params); //dsf.createDataStore( params ); log.info("columns: " + ds.getNames()); String name = FilenameUtils.getBaseName(f.getName()); fs = ds.getFeatureSource(name); monitor.worked(1); // checking geometries SubMonitor submon = new SubMonitor(monitor, 1); submon.beginTask("checking all features", IProgressMonitor.UNKNOWN); FeatureCollection results = fs.getFeatures(); try (FeatureIterator it = results.features();) { while (it.hasNext()) { Feature feature = it.next(); // geometry GeometryAttribute geom = feature.getDefaultGeometryProperty(); if (geom == null || geom.getValue() == null) { throw new RuntimeException("Feature has no geometry: " + feature.getIdentifier().getID()); } // other checks...? monitor.worked(1); } } site.ok.set(true); exc = null; } catch (IOException e) { site.ok.set(false); exc = e; } }
From source file:edu.uw.apl.nativelibloader.NativeLoader.java
static private synchronized void loadNativeLibrary(String prefix, String libName) throws IOException { log.debug("Loading: " + prefix + " " + libName); Properties p = loadConfiguration(prefix, libName); if (isDefined("disabled", prefix, libName, p)) { log.debug("Loading disabled: " + prefix + "," + libName); return;//from ww w . ja va 2s . c o m } if (isDefined("useExternal", prefix, libName, p)) { /* Load external artifact (i.e. one found, hopefully, using -Djava.library.path). Do NOT proceed to load from a local resource */ System.loadLibrary(libName); return; } File nativeLibFile = findNativeLibrary(prefix, libName, p); if (nativeLibFile != null) { System.load(nativeLibFile.getPath()); } }
From source file:com.liferay.nativity.control.win.WindowsNativityUtil.java
private static boolean _loadLibrary(boolean fullPath, String path) { _logger.trace("Trying to load {} {}", fullPath, path); try {//from www.j a v a2 s . c o m if (fullPath) { System.load(path); } else { System.loadLibrary(path); } _loaded = true; _logger.trace("Loaded library {}", path); } catch (UnsatisfiedLinkError e) { _logger.error("Library Path : {}", System.getProperty("java.library.path")); _logger.error("Failed to load {} {}", e.getMessage(), path); } catch (Exception e) { _logger.error("Failed to load {}", path); _logger.error(e.getMessage(), e); } return _loaded; }