try {
Object obj = xmcf.createInstanceWithContext(
"com.sun.star.script.Application" + name + "LibraryContainer",
context.getComponentContext());
XLibraryContainer xLibraryContainer = (XLibraryContainer)
UnoRuntime.queryInterface(XLibraryContainer.class, obj);
System.err.println("Got XLibraryContainer");
Object serviceObj = context.getComponentContext().getValueByName(
"/singletons/com.sun.star.util.theMacroExpander");
XMacroExpander xme = (XMacroExpander) AnyConverter.toObject(
new Type(XMacroExpander.class), serviceObj);
String bootstrapName = "bootstraprc";
if (System.getProperty("os.name").startsWith("Windows")) {
bootstrapName = "bootstrap.ini";
}
String libURL = xme.expandMacros(
"${$BRAND_BASE_DIR/program/" + bootstrapName + "::BaseInstallation}" +
"/share/basic/ScriptBindingLibrary/" +
name.toLowerCase() + ".xlb/");
System.err.println("libURL is: " + libURL);
xLibraryContainer.createLibraryLink(
"ScriptBindingLibrary", libURL, false);
System.err.println("liblink created");
} catch (com.sun.star.uno.Exception e) {