我正在写一个由插件组成的Eclipse产品。
在我的一个插件中,我需要获取安装Eclipse的目录的绝对路径。
(即,在Mac上为/Applications/Eclipse
或在Win上为C:\Program Files\Eclipse
)。
找不到为此的API。有想法吗?
最佳答案
codejammer建议:
Platform.getInstallLocation().getURL()
见
org.eclipse.core.runtime.Platform
API/**
* Returns the location of the base installation for the running platform
* <code>null</code> is returned if the platform is running without a configuration location.
* <p>
* This method is equivalent to acquiring the <code>org.eclipse.osgi.service.datalocation.Location</code>
* service with the property "type" equal to {@link Location#INSTALL_FILTER}.
*</p>
* @return the location of the platform's installation area or <code>null</code> if none
* @since 3.0
* @see Location#INSTALL_FILTER
*/
关于eclipse-plugin - 如何获得Eclipse安装目录的绝对路径?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4494528/