McDermott, Andrew a écrit :
Hi,
Can you elaborate on how you make this selection, and how
you package
the fragment?
=> Since fragments are host-specific, only the fragment you
need will be loaded.
(If you use an update site, only the fragment you need
will be downloaded).
Note: the System property "java.library.path" is also set in
the plugin Activator, in order to found the embedded
dll/shared library in the right fragment.
I didn't think it was possible to change "java.library.path" after the
VM has started. If it is possible to change this value then that may
have an adverse affect on other plugins. Or is the change isolated just
to the plugin itself?
Do you mind posting your plugin Activator that sets this property?
Changing this values affects all the VM, not only the plugin.
Here is a code snippet:
// Step 1:
// find the location of the DLL/shared library
// In my example, it's embedded in the fragment
// WARNING: fragment MUST NOT be packaged as a jar file !!!
String os_name = Platform.getOS();
String fragment_id = "org.sqlitejdbc." + os_name;
Bundle b = Platform.getBundle(fragment_id);
if (b == null) {
// add error handling here.
// however, it should never occurs.
}
URL fragmentUrl = b.getEntry("/");
URL resUrl = null;
try {
resUrl = FileLocator.resolve(fragmentUrl);
} catch (IOException e1) {
// add error handling here
// may occurs if the fragment is packaged as a jar file
}
String filename = resUrl.getFile();
String protocol = resUrl.getProtocol();
if (!"file".equals(protocol))
{
// add error handling here
// may occurs if the fragment is packaged as a jar file
}
File fragmentFile = new File(fragmentUri);
String fragmentPath = fragmentFile.getAbsolutePath();
// Step 2: retrieve and update java.library.path
String libpathvar = "java.library.path";
String ldpathvalue = System.getProperty(libpathvar);
ldpathvalue = fragmentPath + java.io.File.pathSeparator +
ldpathvalue;
System.setProperty(libpathvar, ldpathvalue);
Is it suitable for your needs ?
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------