Unfolding automatically an Eclipse plugin jar

后端 未结 3 399
囚心锁ツ
囚心锁ツ 2021-01-24 18:55

My Eclipse plugin needs to be executed unfolded as a flat directory (it uses JNI, and the JNI part needs access to some files provided by the plugin). Is it possible to configur

3条回答
  •  一向
    一向 (楼主)
    2021-01-24 19:18

    The most common way to do this is to use org.osgi.framework.Bundle.getEntry(String) and then org.eclipse.core.runtime.FileLocator.toFileURL(URL). getEntry("/jni_lib/") will return a URL that points to a folder, and FileLocator will expand the requested bundle URL to the local disk if necessary. This works if you use features or not, if the plugins on disk are exported or not, etc.

    @vanaprogeja proposed the second most common option, and needs features to work (which is perfectly acceptable)

提交回复
热议问题