List of usage examples for java.lang System loadLibrary
@CallerSensitive public static void loadLibrary(String libname)
From source file:com.izforge.izpack.util.Librarian.java
/** * Loads a system library.//from w ww .j ava 2 s.c o m * * @param name the library name * @param client the native library client * @return <tt>true</tt> if the library was loaded successfully, otherwise <tt>false</tt> */ private boolean loadSystemLibrary(String name, NativeLibraryClient client) { try { System.loadLibrary(name); clients.add(client); return true; } catch (Throwable exception) { logger.log(Level.FINE, "Failed to load library: " + name + ": " + exception.getMessage(), exception); } return false; }
From source file:imageviewer.system.ImageViewerClient.java
private void initialize(CommandLine args) { // First, process all the different command line arguments that we // need to override and/or send onwards for initialization. boolean fullScreen = (args.hasOption("fullscreen")) ? true : false; String dir = (args.hasOption("dir")) ? args.getOptionValue("dir") : null; String type = (args.hasOption("type")) ? args.getOptionValue("type") : "DICOM"; String prefix = (args.hasOption("client")) ? args.getOptionValue("client") : null; LOG.info("Java home environment: " + System.getProperty("java.home")); // Logging system taken care of through properties file. Check // for JAI. Set up JAI accordingly with the size of the cache // tile and to recycle cached tiles as needed. verifyJAI();// www. ja va2 s . c o m TileCache tc = JAI.getDefaultInstance().getTileCache(); tc.setMemoryCapacity(32 * 1024 * 1024); TileScheduler ts = JAI.createTileScheduler(); ts.setPriority(Thread.MAX_PRIORITY); JAI.getDefaultInstance().setTileScheduler(ts); JAI.getDefaultInstance().setRenderingHint(JAI.KEY_CACHED_TILE_RECYCLING_ENABLED, Boolean.TRUE); // Set up the frame and everything else. First, try and set the // UI manager to use our look and feel because it's groovy and // lets us control the GUI components much better. try { UIManager.setLookAndFeel(new ImageViewerLookAndFeel()); LookAndFeelAddons.setAddon(ImageViewerLookAndFeelAddons.class); } catch (Exception exc) { LOG.error("Could not set imageViewer L&F."); } // Load up the ApplicationContext information... ApplicationContext ac = ApplicationContext.getContext(); if (ac == null) { LOG.error("Could not load configuration, exiting."); System.exit(1); } // Override the client node information based on command line // arguments...Make sure that the files are there, otherwise just // default to a local configuration. String hostname = new String("localhost"); try { hostname = InetAddress.getLocalHost().getHostName(); } catch (Exception exc) { } String[] gatewayConfigs = (prefix != null) ? (new String[] { "resources/server/" + prefix + "GatewayConfig.xml", (String) ac.getProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG), "resources/server/" + hostname + "GatewayConfig.xml", "resources/server/localGatewayConfig.xml" }) : (new String[] { (String) ac.getProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG), "resources/server/" + hostname + "GatewayConfig.xml", "resources/server/localGatewayConfig.xml" }); String[] nodeConfigs = (prefix != null) ? (new String[] { "resources/server/" + prefix + "NodeConfig.xml", (String) ac.getProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE), "resources/server/" + hostname + "NodeConfig.xml", "resources/server/localNodeConfig.xml" }) : (new String[] { (String) ac.getProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE), "resources/server/" + hostname + "NodeConfig.xml", "resources/server/localNodeConfig.xml" }); for (int loop = 0; loop < gatewayConfigs.length; loop++) { String s = gatewayConfigs[loop]; if ((s != null) && (s.length() != 0) && (!"null".equals(s))) { File f = new File(s); if (f.exists()) { ac.setProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG, s); break; } } } LOG.info("Using gateway config: " + ac.getProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG)); for (int loop = 0; loop < nodeConfigs.length; loop++) { String s = nodeConfigs[loop]; if ((s != null) && (s.length() != 0) && (!"null".equals(s))) { File f = new File(s); if (f.exists()) { ac.setProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE, s); break; } } } LOG.info("Using client config: " + ac.getProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE)); // Load the layouts and set the default window/level manager... LayoutFactory.initialize(); DefaultWindowLevelManager dwlm = new DefaultWindowLevelManager(); // Create the main JFrame, set its behavior, and let the // ApplicationPanel know the glassPane and layeredPane. Set the // menubar based on reading in the configuration menus. mainFrame = new JFrame("imageviewer"); try { ArrayList<Image> iconList = new ArrayList<Image>(); iconList.add(ImageIO.read(new File("resources/icons/mii.png"))); iconList.add(ImageIO.read(new File("resources/icons/mii32.png"))); mainFrame.setIconImages(iconList); } catch (Exception exc) { } mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { int confirm = ApplicationPanel.getInstance().showDialog( "Are you sure you want to quit imageViewer?", null, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, UIManager.getIcon("Dialog.shutdownIcon")); if (confirm == JOptionPane.OK_OPTION) { boolean hasUnsaved = SaveStack.getInstance().hasUnsavedItems(); if (hasUnsaved) { int saveResult = ApplicationPanel.getInstance().showDialog( "There is still unsaved data. Do you want to save this data in the local archive?", null, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_CANCEL_OPTION); if (saveResult == JOptionPane.CANCEL_OPTION) return; if (saveResult == JOptionPane.YES_OPTION) SaveStack.getInstance().saveAll(); } LOG.info("Shutting down imageServer local archive..."); try { ImageViewerClientNode.getInstance().shutdown(); } catch (Exception exc) { LOG.error("Problem shutting down imageServer local archive..."); } finally { System.exit(0); } } } }); String menuFile = (String) ApplicationContext.getContext().getProperty(ac.CONFIG_MENUS); String ribbonFile = (String) ApplicationContext.getContext().getProperty(ac.CONFIG_RIBBON); if (menuFile != null) { JMenuBar mb = new JMenuBar(); mb.setBackground(Color.black); MenuReader.parseFile(menuFile, mb); mainFrame.setJMenuBar(mb); ApplicationContext.getContext().setApplicationMenuBar(mb); } else if (ribbonFile != null) { RibbonReader rr = new RibbonReader(); JRibbon jr = rr.parseFile(ribbonFile); mainFrame.getContentPane().add(jr, BorderLayout.NORTH); ApplicationContext.getContext().setApplicationRibbon(jr); } mainFrame.getContentPane().add(ApplicationPanel.getInstance(), BorderLayout.CENTER); ApplicationPanel.getInstance().setGlassPane((JPanel) (mainFrame.getGlassPane())); ApplicationPanel.getInstance().setLayeredPane(mainFrame.getLayeredPane()); // Load specified plugins...has to occur after the menus are // created, btw. PluginLoader.initialize("config/plugins.xml"); // Detect operating system... String osName = System.getProperty("os.name"); ApplicationContext.getContext().setProperty(ApplicationContext.OS_NAME, osName); LOG.info("Detected operating system: " + osName); // Try and hack the searched library paths if it's windows so we // can add a local dll path... try { if (osName.contains("Windows")) { Field f = ClassLoader.class.getDeclaredField("usr_paths"); f.setAccessible(true); String[] paths = (String[]) f.get(null); String[] tmp = new String[paths.length + 1]; System.arraycopy(paths, 0, tmp, 0, paths.length); File currentPath = new File("."); tmp[paths.length] = currentPath.getCanonicalPath() + "/lib/dll/"; f.set(null, tmp); f.setAccessible(false); } } catch (Exception exc) { LOG.error("Error attempting to dynamically set library paths."); } // Get screen resolution... GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getDefaultConfiguration(); Rectangle r = gc.getBounds(); LOG.info("Detected screen resolution: " + (int) r.getWidth() + "x" + (int) r.getHeight()); // Try and see if Java3D is installed, and if so, what version... try { VirtualUniverse vu = new VirtualUniverse(); Map m = vu.getProperties(); String s = (String) m.get("j3d.version"); LOG.info("Detected Java3D version: " + s); } catch (Throwable t) { LOG.info("Unable to detect Java3D installation"); } // Try and see if native JOGL is installed... try { System.loadLibrary("jogl"); ac.setProperty(ApplicationContext.JOGL_DETECTED, Boolean.TRUE); LOG.info("Detected native libraries for JOGL"); } catch (Throwable t) { LOG.info("Unable to detect native JOGL installation"); ac.setProperty(ApplicationContext.JOGL_DETECTED, Boolean.FALSE); } // Start the local client node to connect to the network and the // local archive running on this machine...Thread the connection // process so it doesn't block the imageViewerClient creating this // instance. We may not be connected to the given gateway, so the // socketServer may go blah... final boolean useNetwork = (args.hasOption("nonet")) ? false : true; ApplicationPanel.getInstance().addStatusMessage("ImageViewer is starting up, please wait..."); if (useNetwork) LOG.info("Starting imageServer client to join network - please wait..."); Thread t = new Thread(new Runnable() { public void run() { try { ImageViewerClientNode.getInstance( (String) ApplicationContext.getContext() .getProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG), (String) ApplicationContext.getContext() .getProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE), useNetwork); ApplicationPanel.getInstance().addStatusMessage("Ready"); } catch (Exception exc) { exc.printStackTrace(); } } }); t.setPriority(9); t.start(); this.fullScreen = fullScreen; mainFrame.setUndecorated(fullScreen); // Set the view to encompass the default screen. if (fullScreen) { Insets i = Toolkit.getDefaultToolkit().getScreenInsets(gc); mainFrame.setLocation(r.x + i.left, r.y + i.top); mainFrame.setSize(r.width - i.left - i.right, r.height - i.top - i.bottom); } else { mainFrame.setSize(1100, 800); mainFrame.setLocation(r.x + 200, r.y + 100); } if (dir != null) ApplicationPanel.getInstance().load(dir, type); timer = new Timer(); timer.schedule(new GarbageCollectionTimer(), 5000, 2500); mainFrame.setVisible(true); }
From source file:fr.fastconnect.factory.tibco.bw.maven.AbstractBWMojo.java
protected boolean initHawk(boolean failIfNotFound) throws BinaryMissingException { if (tibcoRvHomePath == null || !tibcoRvHomePath.exists()) { if (failIfNotFound) { throw new BinaryMissingException(HAWK_BINARY_NOTFOUND); } else {/*w w w .j av a 2 s. c o m*/ getLog().info("Unable to init Hawk."); return false; } } File tibrvj; if (SystemUtils.IS_OS_WINDOWS) { getLog().debug("Windows OS"); tibcoRvHomePath = new File(tibcoRvHomePath, "bin/"); tibrvj = new File(tibcoRvHomePath, "tibrvj.dll"); System.load(tibrvj.getAbsolutePath()); } else { getLog().debug("Not Windows OS"); tibcoRvHomePath = new File(tibcoRvHomePath, "lib/"); String osArch = System.getProperty("os.arch"); tibrvj = null; if (osArch.equals("x86")) { getLog().debug("x86"); tibrvj = new File(tibcoRvHomePath, "libtibrvj.so"); System.loadLibrary("tibrvj"); } else if (osArch.contains("64")) { getLog().debug("64"); tibrvj = new File(tibcoRvHomePath, "libtibrvj64.so"); System.loadLibrary("tibrvj64"); } } getLog().debug("Loading system library : " + tibrvj.getAbsolutePath()); return true; }
From source file:com.wheelphone.remotemini.WheelphoneRemoteMini.java
/** A helper for loading native libraries stored in "libs/armeabi*". */ public static boolean loadLibrary(String nLibName) { try {/*from w ww .ja va 2 s . co m*/ System.loadLibrary(nLibName); Log.i(TAG, "Native library lib" + nLibName + ".so loaded"); return true; } catch (UnsatisfiedLinkError ulee) { Log.e(TAG, "The library lib" + nLibName + ".so could not be loaded"); } catch (SecurityException se) { Log.e(TAG, "The library lib" + nLibName + ".so was not allowed to be loaded"); } return false; }
From source file:com.mdground.screen.activity.MainActivity.java
private void initBaiduTTS() { System.loadLibrary("gnustl_shared"); // ??BDSpeechDecoder_V1 try {//w w w . ja v a 2 s. com System.loadLibrary("BDSpeechDecoder_V1"); } catch (UnsatisfiedLinkError e) { SpeechLogger.logD("load BDSpeechDecoder_V1 failed, ignore"); } System.loadLibrary("bd_etts"); System.loadLibrary("bds"); speechSynthesizer = SpeechSynthesizer.newInstance(SpeechSynthesizer.SYNTHESIZER_AUTO, getApplicationContext(), "holder", this); // ???apikeysecretkey (?) speechSynthesizer.setApiKey("Dj4jyvL8cO8STPQ7PWY8YmHM", "a9ac5facd39ebfcab3b0bceb24606d90"); // ???App ID (?) speechSynthesizer.setAppId("6691671"); // ?LICENCE_FILE_NAME???license?[?]????? // speechSynthesizer.setParam(SpeechSynthesizer.PARAM_TTS_LICENCE_FILE, // LICENCE_FILE_NAME); // TTS???????? String ttsTextModelFilePath = getApplicationContext().getApplicationInfo().dataDir + "/lib/libbd_etts_text.dat.so"; String ttsSpeechModelFilePath = getApplicationContext().getApplicationInfo().dataDir + "/lib/libbd_etts_speech_female.dat.so"; // ? speechSynthesizer.setParam(SpeechSynthesizer.PARAM_TTS_THREAD_PRIORITY, "1"); speechSynthesizer.setParam(SpeechSynthesizer.PARAM_VOCODER_OPTIM_LEVEL, "0"); speechSynthesizer.setParam(SpeechSynthesizer.PARAM_TTS_TEXT_MODEL_FILE, ttsTextModelFilePath); speechSynthesizer.setParam(SpeechSynthesizer.PARAM_TTS_SPEECH_MODEL_FILE, ttsSpeechModelFilePath); speechSynthesizer.setParam(SpeechSynthesizer.PARAM_VOLUME, "9"); // speechSynthesizer.setParam(SpeechSynthesizer.PARAM_PITCH, "9"); speechSynthesizer.setParam(SpeechSynthesizer.PARAM_SPEED, "3"); DataInfoUtils.verifyDataFile(ttsTextModelFilePath); DataInfoUtils.getDataFileParam(ttsTextModelFilePath, DataInfoUtils.TTS_DATA_PARAM_DATE); DataInfoUtils.getDataFileParam(ttsTextModelFilePath, DataInfoUtils.TTS_DATA_PARAM_SPEAKER); DataInfoUtils.getDataFileParam(ttsTextModelFilePath, DataInfoUtils.TTS_DATA_PARAM_GENDER); DataInfoUtils.getDataFileParam(ttsTextModelFilePath, DataInfoUtils.TTS_DATA_PARAM_CATEGORY); DataInfoUtils.getDataFileParam(ttsTextModelFilePath, DataInfoUtils.TTS_DATA_PARAM_LANGUAGE); speechSynthesizer.initEngine(); setVolumeControlStream(AudioManager.STREAM_MUSIC); }
From source file:com.eucalyptus.storage.DASManager.java
public void initialize() { if (!initialized) { System.loadLibrary("dascontrol"); registerSignals(); initialized = true; } }
From source file:com.att.aro.core.util.Util.java
/** * Load the JNI library from the folder specified by java.library.path * // w w w . ja va 2 s.c o m * @param libName */ public static boolean loadSystemLibrary(String filename) { try { System.loadLibrary(filename); return true; } catch (Exception e) { return false; } }
From source file:com.xperia64.timidityae.TimidityActivity.java
@SuppressLint("InlinedApi") @Override//w w w. j a v a2 s .c o m protected void onCreate(Bundle savedInstanceState) { deadlyDeath = false; if (savedInstanceState == null) { Globals.reloadSettings(this, getAssets()); } else { // For some reason when I kill the activity and restart it, justtheme is true, but Globals.theme = 0 if (!savedInstanceState.getBoolean("justtheme", false) || Globals.theme == 0) { Globals.reloadSettings(this, getAssets()); } } try { System.loadLibrary("timidityhelper"); } catch (UnsatisfiedLinkError e) { Log.e("Bad:", "Cannot load timidityhelper"); Globals.nativeMidi = Globals.onlyNative = true; } if (JNIHandler.loadLib(Globals.getLibDir(this) + "libtimidityplusplus.so") < 0) { Log.e("Bad:", "Cannot load timidityplusplus"); Globals.nativeMidi = Globals.onlyNative = true; } else { Globals.libLoaded = true; } oldTheme = Globals.theme; this.setTheme( (Globals.theme == 1) ? android.support.v7.appcompat.R.style.Theme_AppCompat_Light_DarkActionBar : android.support.v7.appcompat.R.style.Theme_AppCompat); super.onCreate(savedInstanceState); if (savedInstanceState == null) { Log.i("Timidity", "Initializing"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // Uggh. requestPermissions(); } else { yetAnotherInit(); } } else { Log.i("Timidity", "Resuming..."); needService = !isMyServiceRunning(MusicService.class); Fragment tmp = getSupportFragmentManager().getFragment(savedInstanceState, "playfrag"); if (tmp != null) playFrag = (PlayerFragment) tmp; tmp = getSupportFragmentManager().getFragment(savedInstanceState, "plfrag"); if (tmp != null) plistFrag = (PlaylistFragment) tmp; tmp = getSupportFragmentManager().getFragment(savedInstanceState, "fffrag"); if (tmp != null) fileFrag = (FileBrowserFragment) tmp; if (!isMyServiceRunning(MusicService.class)) { Globals.reloadSettings(this, getAssets()); initCallback2(); if (viewPager != null) { if (viewPager.getCurrentItem() == 1) { viewPager.setCurrentItem(0); } } } /*if(!savedInstanceState.getBoolean("justtheme", false)) { Globals.reloadSettings(this, getAssets()); }*/ } /*IntentFilter filter = new IntentFilter(); filter.addAction("com.xperia64.timidityae20.ACTION_STOP"); filter.addAction("com.xperia64.timidityae20.ACTION_PAUSE"); filter.addAction("com.xperia64.timidityae20.ACTION_NEXT"); filter.addAction("com.xperia64.timidityae20.ACTION_PREV");*/ //registerReceiver(receiver, filter); setContentView(R.layout.main); if (activityReceiver != null) { //Create an intent filter to listen to the broadcast sent with the action "ACTION_STRING_ACTIVITY" IntentFilter intentFilter = new IntentFilter(getResources().getString(R.string.ta_rec)); //Map the intent filter to the receiver registerReceiver(activityReceiver, intentFilter); } //Start the service on launching the application if (needService) { needService = false; Globals.probablyFresh = 0; //System.out.println("Starting service"); startService(new Intent(this, MusicService.class)); } viewPager = (ViewPager) findViewById(R.id.vp_main); viewPager.setAdapter(new TimidityFragmentPagerAdapter()); viewPager.addOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int index) { mode = index; switch (index) { case 0: fromPlaylist = false; if (getSupportActionBar() != null) { if (menuButton != null) { menuButton.setIcon(R.drawable.ic_menu_refresh); menuButton.setVisible(true); menuButton.setEnabled(true); menuButton.setTitle(getResources().getString(R.string.refreshfld)); menuButton.setTitleCondensed(getResources().getString(R.string.refreshcon)); } if (menuButton2 != null) { menuButton2.setIcon(R.drawable.ic_menu_home); menuButton2.setTitle(getResources().getString(R.string.homefld)); menuButton2.setTitleCondensed(getResources().getString(R.string.homecon)); menuButton2.setVisible(true); menuButton2.setEnabled(true); } getSupportActionBar().setDisplayHomeAsUpEnabled(needFileBack); } else { getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setHomeButtonEnabled(false); } if (fileFrag != null) if (fileFrag.getListView() != null) fileFrag.getListView().setFastScrollEnabled(true); break; case 1: if (getSupportActionBar() != null) { if (menuButton != null) { menuButton.setIcon(R.drawable.ic_menu_agenda); menuButton.setTitle(getResources().getString(R.string.view)); menuButton.setTitleCondensed(getResources().getString(R.string.viewcon)); menuButton.setVisible((!JNIHandler.type) && Globals.isPlaying == 0); menuButton.setEnabled((!JNIHandler.type) && Globals.isPlaying == 0); } if (menuButton2 != null) { menuButton2.setIcon(R.drawable.ic_menu_info_details); menuButton2.setTitle(getResources().getString(R.string.playback)); menuButton2.setTitleCondensed(getResources().getString(R.string.playbackcon)); menuButton2.setVisible((!JNIHandler.type) && Globals.isPlaying == 0); menuButton2.setEnabled((!JNIHandler.type) && Globals.isPlaying == 0); } getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setHomeButtonEnabled(false); } break; case 2: fromPlaylist = true; if (getSupportActionBar() != null) { if (menuButton != null) { menuButton.setIcon(R.drawable.ic_menu_refresh); menuButton.setTitle(getResources().getString(R.string.refreshpls)); menuButton.setTitleCondensed(getResources().getString(R.string.refreshcon)); menuButton.setVisible(true); menuButton.setEnabled(true); } if (menuButton2 != null) { menuButton2.setIcon(R.drawable.ic_menu_add); menuButton2.setTitle(getResources().getString(R.string.add)); menuButton2.setTitleCondensed(getResources().getString(R.string.addcon)); if (plistFrag != null) { menuButton2.setVisible((plistFrag.plistName != null && plistFrag.mode) ? !plistFrag.plistName.equals("CURRENT") : true); menuButton2.setEnabled((plistFrag.plistName != null && plistFrag.mode) ? !plistFrag.plistName.equals("CURRENT") : true); } } if (plistFrag != null) if (plistFrag.getListView() != null) plistFrag.getListView().setFastScrollEnabled(true); if (needPlaylistBack) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } } else { getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setHomeButtonEnabled(false); } break; } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); }
From source file:com.microsoft.tfs.jni.loader.NativeLoader.java
/** * Loads the given library name using the enhanced method documented in this * class's Javadoc. If a library is already loaded, subsequent calls to this * method with the same library name will be ignored. * * @param libraryName/* ww w . j a v a 2s .c o m*/ * the library name (short name, not including extension or "lib" * prefix). Not null or empty. * @throws UnsatisfiedLinkError * if a library that maps to the given library name cannot be found. * @throws IOException * if an error occured reading a native library resource or writing * it to a temporary location. */ public static void loadLibrary(final String libraryName) throws UnsatisfiedLinkError, IOException { Check.notNullOrEmpty(libraryName, "libraryName"); //$NON-NLS-1$ log.debug(MessageFormat.format("Loading library {0}", libraryName)); //$NON-NLS-1$ final String osgiOperatingSystem = getOSGIOperatingSystem(); if (osgiOperatingSystem == null) { throw new UnsatisfiedLinkError( "Could not determine OSGI-style operating system name for resource path construction"); //$NON-NLS-1$ } String osgiArchitecture = getOSGIArchitecture(); if (osgiArchitecture == null) { throw new UnsatisfiedLinkError( "Could not determine OSGI-style architecture for resource path construction"); //$NON-NLS-1$ } /* * Even though we make sure the OSGI architecture string we loaded is * non-null, we want to use a null architecture string for loading if * we're on Mac OS X. This is because OS X has "fat" libraries and * executables, and we don't want to build a path containing an * architecture. */ if (Platform.isCurrentPlatform(Platform.MAC_OS_X)) { osgiArchitecture = null; } /* * If the system property is set, only load from that location (do not * fallback to other locations). */ final String loadFromDirectory = System.getProperty(NATIVE_LIBRARY_BASE_DIRECTORY_PROPERTY); if (loadFromDirectory != null) { log.debug(MessageFormat.format("Property {0} set to {1}; only looking there for native libraries", //$NON-NLS-1$ NATIVE_LIBRARY_BASE_DIRECTORY_PROPERTY, loadFromDirectory)); // Throws on error. loadLibraryFromDirectory(libraryName, loadFromDirectory, osgiOperatingSystem, osgiArchitecture); // Success. return; } /* * Use the Java built-in mechanisms for finding the library. This call * obeys java.library.path, LD_LIBRARY_PATH (Unix), DLL search path * (Windows), and more. It will throw if it fails. */ System.loadLibrary(libraryName); log.info(MessageFormat.format("Loaded {0} with System.loadLibrary()", libraryName)); //$NON-NLS-1$ }
From source file:interactivespaces.launcher.bootstrap.InteractiveSpacesFrameworkBootstrap.java
/** * Load a collection of libraries.//from w w w . jav a 2s .co m * * @param libraries * the libraries to load */ private void loadLibraries(List<String> libraries) { for (String library : libraries) { loggingProvider.getLog().info(String.format("Loading system library %s", library)); System.loadLibrary(library); } }