[MyEclipse]插件安装失败通用解决方案(亲测有效)

1.我们通常安装插件到eclipse中的方法是:

1)到插件网站下载插件压缩包 

2)解压后插件拷贝到【plugins】和【features】拷贝到eclipse下的同名目录下。

      也可以把插件解压到任何目录(比如:d:\myeclipse\myplugin\svn)下,

      然后在(<eclipse安装目录>\dropins)下新建文件svn.link,内容是:path=d:\\myeclipse \\myplugin\\svn 保存。

3)然后重启eclipse,多数情况下,插件能安装成功。

 

但是有时重启elipse后插件并没有成功的加载,本人在安装svn插件的时候就碰到了这个问题。

从官网下载插件后、安装上述步骤解压、导入,但是插件没有成功加载,解决方案如下:

1)清空【configuration/org.eclipse.update】所有文件,重启eclipse。

     该办法有时也未必起效。

2) MyEclipse 安装插件是会在路径 \configuration\org.eclipse.equinox.simpleconfigurator\bundles.info
文件生成相应的代码。  一般插件没有加载都是没有生成相应代码的缘故。可以使用下列程序生成代码,并拷贝到bundles.info文件的末尾就可以。

package iptv;

import java.io.File;
import java.util.*;
/**
 * myeclipse插件安装失败解决方案
 * 参考:https://blog.csdn.net/szwangdf/article/details/102058677
 * @author 王德封
 *
 */

public class MyEclipsePluginInstall {

	/**
	 * myeclipse插件安装失败解决方案
	 * 将本程序生成的代码拷贝到
	 * 详细参考:https://blog.csdn.net/szwangdf/article/details/102058677
	 * @param args
	 */
	public static void main(String[] args) {
		//插件自定义安装目录
		String path = "D:\\myeclipse\\myplugins\\svn";
		new MyEclipsePluginInstall().print(path);
		//从控制台打印的代码拷贝到:\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info
		//重启myeclipse
	}

	public MyEclipsePluginInstall() {

	}

	public void print(String pluginPath) {
		List<String> fileList = getFileList(pluginPath);
		if (fileList == null) {
			return;
		}
		int length = fileList.size();
		for (int i = 0; i < length; i++) {
			String result = "";
			String thePath = getFormatPath(getString(fileList.get(i)));
			File file = new File(thePath);
			if (file.isDirectory()) {
				String fileName = file.getName();
				if (fileName.indexOf("_") < 0) {
					print(thePath);
					continue;
				}
				String[] fileNames = fileName.split("_");
				String filename1 = fileNames[0];
				String filename2 = fileNames[1];
				result = filename1 + "," + filename2 + ",file:/" + pluginPath + "/" + fileName + "\\,4,false";
				System.out.println(result);
			} else if (file.isFile()) {
				String fileName = file.getName();
				if (fileName.indexOf("_") < 0) {
					continue;
				}
				int last = fileName.lastIndexOf("_");
				String filename1 = fileName.substring(0, last);
				String filename2 = fileName.substring(last + 1, fileName.length() - 4);
				result = filename1 + "," + filename2 + ",file:/" + pluginPath + "/" + fileName + ",4,false";
				System.out.println(result);
			}
		}
	}

	public List<String> getFileList(String path) {
		path = getFormatPath(path);
		path = path + "/";
		File filePath = new File(path);
		if (!filePath.isDirectory()) {
			return null;
		}
		String[] fileList = filePath.list();
		List<String> filelistFilter = new ArrayList<String>();
		for (int i = 0; i < fileList.length; i++) {
			String tempFilename = getFormatPath(path + fileList[i]);
			filelistFilter.add(tempFilename);
		}
		return filelistFilter;

	}

	public String getFormatPath(String path) {
		path = path.replaceAll("\\\\", "/");
		path = path.replaceAll("//", "/");
		return path;
	}

	public String getString(Object object) {
		if (object == null) {
			return "";
		}
		return String.valueOf(object);
	}
}

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值