import java.io.IOException;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
import com.work.base.exception.DataException;
import com.work.view.Activator;
public class BundlePathUtil {
    public static String getRealPath(String bundleID, String entry)
            throws DataException {
        URL urlentry;
        String strEntry;
        try {
            Bundle bundle = Platform.getBundle(bundleID);
            if (bundle==null)
                throw new DataException("请检查文件的路径",new NullPointerException());
            // get path URL
            urlentry = bundle.getEntry(entry);
            if (urlentry==null)
                throw new DataException("请检查文件的路径",new NullPointerException());
            strEntry = FileLocator.toFileURL(urlentry).getPath();
        } catch (IOException e1) {
            throw new DataException("请检查文件的路径", e1);
        }
        return strEntry;
    }
    
    public static String getPluginPath(){        
        return Activator.getDefault().getStateLocation().makeAbsolute().toFile().getAbsolutePath();
        
    }   
    
}
另外,获取插件/rcp 的workspace的路径:
Platform.getInstanceLocation().getURL().getPath()