开发者

Running Eclipse Equinox and an Application from a single Jar using no other files

I have an application that uses the Eclipse runtime. Unfortunately, due to restrictions in Equinox (the Eclispe OSGi implementation), it's not possible to start the Eclipse runtime with all of the plugins on the classpath, so it must actually be located on the disk. (There is code that insists to look for the OSGi framework bundle using a "file:" URL protocol).

I need to have my application (with Eclipse) be in a single JAR file and have no dependencies on external environment variable settings. You should be able to call my app's API like any other and it should just work. How I have implemented this is to create a temporary directory using the Java temp file support (i.e. File.createTempFile()), and then I read all of the plugins and some other stuff from the classpath and write it to the disk so there is the expected Eclipse installation. This is about 10MB worth of stuff and takes IIRC less than a second. However, I would like to avoid even this if possible by checking to see that it has been done before and not doing it again un开发者_Go百科less there is a problem.

One way that occurs to me is to write some other small file in a known location (like in the user's home directory) that contains the version number of my code and a pointer to the temporary location. Another alternative is to locate the installation in a known place (instead of using the Java temp file support). But then this gets messy with platform specific considerations.

Anyone have a better idea for how to solve this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜