当前位置: 代码迷 >> Eclipse >> rcp(插件开发) 怎么获取eclipse or rcp的安装目录
  详细解决方案

rcp(插件开发) 怎么获取eclipse or rcp的安装目录

热度:26   发布时间:2016-04-23 12:23:54.0
rcp(插件开发) 如何获取eclipse or rcp的安装目录

如题:

如下:

import java.net.URL;

import org.eclipse.core.runtime.Platform;

public class StudioInstallPathUtil {

 public static String getStudioPath(){
  String path = null; 
  //因为getInstallLocation已经单例模式,所以在此我们没必要单例了
  org.eclipse.osgi.service.datalocation.Location location = Platform.getInstallLocation(); 
  if (location != null) { 
      URL url = location.getURL(); 
      path = url.getPath(); 
      path=path.substring(1, path.length()-1);
  } 
  return path;
 }
}

  相关解决方案