首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

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

2012-09-25 
rcp(插件开发) 如何获取eclipse or rcp的安装目录如题:如下:import java.net.URLimport org.eclipse.core

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;
 }
}

热点排行