本文整理汇总了Java中com.sun.jna.NativeLibrary.addSearchPath方法的典型用法代码示例。如果您正苦于以下问题:Java NativeLibrary.addSearchPath方法的具体用法?Java NativeLibrary.addSearchPath怎么用?Java NativeLibrary.addSearchPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jna.NativeLibrary
的用法示例。
在下文中一共展示了NativeLibrary.addSearchPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
@Override
public void initialize(IWorkbenchConfigurer configurer) {
super.initialize(configurer);
org.eclipse.ui.ide.IDE.registerAdapters();
declareWorkbenchImages();
boolean found = false;
String vlcLib = ManagementFactory.getRuntimeMXBean().getSystemProperties().get("vlc");
if (vlcLib != null) {
found = true;
NativeLibrary.addSearchPath("vlc", vlcLib);
}
if (!found) {
found = new NativeDiscovery().discover();
}
if (!found) {
MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Error", "Cannot play videos. VLC is either not installed or located in an unexpected directory. " + "If VLC is installed in an unexpected directory you can provide the path to its library. " + "Find SynergyView.ini and add a line to the end (if not already there) starting with " + "-Dvlc= followed by the path to an installation instance of VLC's lib folder.");
}
}
示例2: startup
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
@Override
public void startup() throws PluginException {
try {
LOGGER.info("Initializing Praat library");
final String praatSearchFolder =
PrefHelper.get(PRAAT_SEARCH_FOLDER, null);
if(praatSearchFolder != null) {
NativeLibrary.addSearchPath("praat", praatSearchFolder);
}
Praat.INSTANCE.praat_lib_init();
final PraatVersion praatVersion = PraatVersion.getVersion();
// print version information to log
final StringBuilder sb = new StringBuilder();
sb.append("Praat version: ").append(praatVersion.versionStr);
sb.append(" ").append(praatVersion.day).append('-').append(praatVersion.month).append('-').append(praatVersion.year);
LOGGER.info(sb.toString());
} catch (UnsatisfiedLinkError e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
示例3: loadVlc
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
public static void loadVlc() {
// String os = System.getProperty("os.name").toLowerCase();
// boolean is64bit = "64".equals(System.getProperty("sun.arch.data.model"));
if (Config.isWindows()) {
// windows
if (Config.is64bit()) {
System.out.println("Loading 64 bit Windows Libraries.");
NativeLibrary.addSearchPath("libvlc", Config.VLC_URL + "windows" + File.separator + "x64" + File.separator);
} else {
System.out.println("Loading 32 bit Windows Libraries.");
NativeLibrary.addSearchPath("libvlc", Config.VLC_URL + "windows" + File.separator + "x86" + File.separator);
}
} else if (Config.isMac()) {
// mac
} else if (Config.isLinux()) {
// linus
} else if (Config.isSolaris()) {
// solaris
}
}
示例4: ensureVLCLib
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
/**
* Ensures that the vlcj Lib is properly loaded
*/
public synchronized static void ensureVLCLib(){
if(!vlcjLoaded && !vlcjLoadError)
{
String vlclibName = RuntimeUtil.getLibVlcLibraryName();
List<String> libPaths = VLCUtil.getVLCLibPaths();
logger.info("jni loading: " + vlclibName);
for (String libPath : libPaths) {
logger.debug("adding search path: " + libPath);
NativeLibrary.addSearchPath(vlclibName, libPath);
}
try{
Native.loadLibrary(vlclibName, LibVlc.class);
vlcjLoaded = true;
}catch(UnsatisfiedLinkError e){
vlcjLoadError = true;
logger.error(e);
}
}
}
示例5: initVideoImportEngine
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
@Override
public void initVideoImportEngine(Optional<String> pathToLibrary) {
if (pathToLibrary.isPresent()) {
log.debug("Path to library {}", pathToLibrary);
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), pathToLibrary.get());
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
log.debug("Library loaded");
}
}
示例6: main
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
public static void main(String[] args) {
// TODO code application logic here
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), NATIVE_LIBRARY_SEARCH_PATH);
System.out.println(LibVlc.INSTANCE.libvlc_get_version());
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new JSTPlay();
}
});
}
示例7: create
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
public void create(String filepath) throws Error {
camera = new OrthographicCamera();
camera.setToOrtho(false, w, h);
camera.update();
LibXUtil.initialise();
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), vlcpath);
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
image = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()
.createCompatibleImage((int) w, (int) h);
image.setAccelerationPriority(1.0f);
String[] args = null;
if ((System.getProperty("os.name").toLowerCase().indexOf("mac") >= 0)) {
String pluginpath = vlcpath.substring(0, vlcpath.lastIndexOf('/')) + "/plugins";
System.out.println(pluginpath);
uk.co.caprica.vlcj.binding.LibC.INSTANCE.setenv("VLC_PLUGIN_PATH", pluginpath, 1);
args = new String[] { "--no-video-title-show", "--verbose=3", "--vout=macosx" };
} else {
args = new String[] { "--no-video-title-show", "--verbose=3" };
}
factory = new MediaPlayerFactory(args);
mediaPlayer = factory.newDirectMediaPlayer(new TestBufferFormatCallback(), new TestRenderCallback());
mediaPlayer.prepareMedia(filepath);
mediaPlayer.start();
mediaPlayer.pause();
System.out.println(LibVlc.INSTANCE.libvlc_get_version());
}
示例8: setupNatives
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
public static void setupNatives() {
if (!checkIsOSSupported()) {
JOptionPane.showMessageDialog(null, "Sorry, " + getArchType() + " " + System.getProperty("os.name") + " is not supported!", "Unsupported OS", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
String nativesFolder = File.separator + "natives" + File.separator;
String suffix = Platform.is64Bit() ? "x64" : "x86";
switch(Platform.getOSType()) {
case Platform.WINDOWS:
nativesFolder += "windows";
break;
case Platform.MAC:
nativesFolder += "mac";
break;
case Platform.LINUX:
nativesFolder += "linux";
break;
case Platform.FREEBSD:
nativesFolder += "freebsd";
break;
case Platform.OPENBSD:
nativesFolder += "openbsd";
break;
}
nativesFolder += File.separator + suffix + File.separator;
String nativesFolderPath = (new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile()).getPath() + nativesFolder;
//System.out.println((new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile()).getPath() + nativesFolder);
if(!new File(nativesFolderPath).exists()) {
//JOptionPane.showMessageDialog(null, "Could not find natives folder: " + nativesFolder, "No Natives Found", JOptionPane.ERROR_MESSAGE);
//System.exit(0);
}
NativeLibrary.addSearchPath("leveldb", nativesFolderPath);
}
示例9: MyVideoPanel
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
public MyVideoPanel() {
NativeLibrary.addSearchPath("libvlc", vlcWhere.getAbsolutePath());
EmbeddedMediaPlayerComponent videoCanvas =
new EmbeddedMediaPlayerComponent();
setLayout(new BorderLayout());
add(videoCanvas, BorderLayout.CENTER);
player = videoCanvas.getMediaPlayer();
}
示例10: loadNativeLibrary
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
/**
* Loads the native libs creating the native wrapper.
*
* @param nativeLibPath the path to add or <code>null</code>.
* @param libName the lib name or <code>null</code>, in which case "las_c" is used.
* @return <code>null</code>, if the lib could be loaded, the error string else.
*/
public static String loadNativeLibrary( String nativeLibPath, String libName ) {
try {
String name = "las_c";
if (libName == null)
libName = name;
if (nativeLibPath != null) {
NativeLibrary.addSearchPath(libName, nativeLibPath);
}
WRAPPER = (LiblasJNALibrary) Native.loadLibrary(libName, LiblasJNALibrary.class);
} catch (UnsatisfiedLinkError e) {
return e.getLocalizedMessage();
}
return null;
}
示例11: EpanetWrapper
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
/**
* Contructor for the {@link EpanetWrapper}.
*
* <p>This also takes care to load the native library, if needed.
*
* @param lib the name of the library (ex. "epanet2_64bit").
* @param nativeLibPath the path in which to search the native library.
* If the native library is already in the java library path
* this is not needed and may be <code>null</code>
* @throws Exception if the library could not be loaded.
*/
public EpanetWrapper( String lib, String nativeLibPath ) throws Exception {
if (epanet == null) {
try {
if (nativeLibPath != null)
NativeLibrary.addSearchPath(lib, nativeLibPath);
epanet = (EpanetNativeFunctions) Native.loadLibrary(lib, EpanetNativeFunctions.class);
} catch (Exception e) {
throw new Exception("An error occurred while trying to load the epanet library.", e);
}
}
}
示例12: JnaNativeLibrary
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
public JnaNativeLibrary(JnaNativeInterface nativeInterface, String name,
Map<String, Object> options) {
this.nativeInterface = nativeInterface;
// this is a kludge - but i can't ask for the searchpaths already
// registered
for (Iterator<String> it = nativeInterface.getSearchPaths().iterator(); it
.hasNext();) {
String path = it.next();
NativeLibrary.addSearchPath(name, path);
}
library = NativeLibrary.getInstance(name, options);
}
示例13: attemptLib
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
private static UnsatisfiedLinkError attemptLib()
{
try
{
String lib = "compileEGMf"; //$NON-NLS-1$
NativeLibrary.addSearchPath(lib,"."); //$NON-NLS-1$
NativeLibrary.addSearchPath(lib,LGM.workDir.getParent());
DRIVER = (EnigmaDriver) Native.loadLibrary(lib,EnigmaDriver.class);
return null;
}
catch (UnsatisfiedLinkError e)
{
return e;
}
}
示例14: ScreenRecorder
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
public ScreenRecorder() {
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), System.getProperty("user.dir")+"/lib");
System.setProperty("VLC_PLUGIN_PATH", System.getProperty("user.dir")+"/lib/plugins");
mediaPlayerFactory = new MediaPlayerFactory(OPTIONS);
mediaPlayer = mediaPlayerFactory.newHeadlessMediaPlayer();
}
示例15: initPlayer
import com.sun.jna.NativeLibrary; //导入方法依赖的package包/类
private void initPlayer() {
boolean found = new NativeDiscovery().discover();
if (!found) {
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), NATIVE_LIBRARY_SEARCH_PATH);
}
}