Вы можете создать плагин "binaries", поместить dll в подпапку bin / of этого, а затем убедиться в манифесте.
* Вы добавляете свойство активатор + синглтон.
* Вы проверяете bin / в разделе «Build», «Runtime Build»
В функции, включающей плагин для двоичных файлов, обязательно установите флажок «Распаковать архив плагина после установки»
В активаторе вашего бинарного плагина добавьте что-то вроде этого:
public enum Tool {reach, ctl, ltl};
private static URI toolUri [] = new URI [3];
public static URI getProgramURI(Tool tool) throws IOException {
if (toolUri[tool.ordinal()] == null) {
String relativePath = "bin/its-"+ tool.toString() ;
URL toolff = getDefault().getBundle().getResource(relativePath);
if (toolff == null) {
log.severe("unable to find an executable [" + tool + "] in path " + relativePath);
Enumeration<URL> e = getDefault().getBundle().findEntries("bin/", "*", true);
log.fine("Lising URL available in bin/");
while (e.hasMoreElements()) {
log.finer(e.nextElement().toString());
}
throw new IOException("unable to find the tool binary");
}
URL tmpURL = FileLocator.toFileURL(toolff);
// use of the multi-argument constructor for URI in order to escape appropriately illegal characters
URI uri;
try {
uri = new URI(tmpURL.getProtocol(), tmpURL.getPath(), null);
} catch (URISyntaxException e) {
throw new IOException("Could not create a URI to access the binary tool :", e);
}
toolUri[tool.ordinal()] = uri;
log.fine("Location of the binary : " + toolUri);
File crocExec = new File(uri);
if (!crocExec.setExecutable(true)) {
log.severe("unable to make the command-line tool executable [" + toolUri + "]");
throw new IOException("unable to make the command-line tool executable");
}
}
return toolUri[tool.ordinal()];
}
Я скопировал вставленный из некоторого моего кода, так что извините, он не совсем соответствует вашему примеру с DLL, я получал пути к исполняемым файлам из ограниченного списка (см. Enum Tool). Последний шаг (установка флага + x в файле), вероятно, бесполезен в вашем случае. С другой стороны, вы получаете некоторый код обработки исключений и кеш бесплатно :) И он довольно тщательно протестирован.
Он выполняет ту работу, которую вы пытаетесь выполнить, передавая URL-адрес двоичного файла последующему плагину.