将本地安装好的eclispe发送到另外一台电脑上所出现的问题及解决方法

一、修改eclipse.ini:

    将本地的eclispe直接拷贝到另一台机器上,运行eclipse.exe直接抛出错误:

The Eclipse executable launcher was unable to locate its companion shared library

    这是由于eclipse.ini中的 --launcher.library 配置有问题,编辑eclipse.ini文件:

将本地安装好的eclispe发送到另外一台电脑上所出现的问题及解决方法

--launcher.library
C:/Users/zhouy/.p2/pool/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.700.v20180518-1200

    可以看到这里的用到了.p2里的内容,故将我本地的.p2文件夹打包发过去,并且将其中的用户改为新电脑上的当前登录用户。所有这些准备好之后再次运行eclipse.exe结果再次跑出了错误,错误如下:

二、修改config.ini

    错误提示如下:

java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)

    查找资料发现是由于config.ini文件的问题,文件内容如下:

#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser
#Tue Dec 04 16:37:03 CST 2018
eclipse.p2.profile=D__software_eclipse20180808_eclipse
[email protected]/workspace
osgi.framework=file\:/C\:/Users/zhouy/.p2/pool/plugins/org.eclipse.osgi_3.13.0.v20180409-1500.jar
equinox.use.ds=true
eclipse.buildId=4.8.0.I20180611-0500
ds.delayed.keepInstances=true
osgi.bundles=reference\:file\:[email protected]1\:start
org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info
eclipse.product=org.eclipse.platform.ide
osgi.splashPath=file\:/C\:/Users/zhouy/.p2/pool/plugins/org.eclipse.platform_4.8.0.v20180611-0500
osgi.framework.extensions=reference\:file\:org.eclipse.osgi.compatibility.state_1.1.100.v20180331-1743.jar,reference\:file\:org.eclipse.equinox.weaving.hook_1.2.100.v20171221-2204.jar
osgi.bundles.defaultStartLevel=4
eclipse.application=org.eclipse.ui.ide.workbench
eclipse.p2.data.area=file\:/C\:/Users/zhouy/.p2/

    可以看到这个文件也用到了.p2里的东西,所以将用户改为新电脑上的用户即可,在这个用户文件夹下肯定是找不到.p2文件夹及内容的。

    改好之后错误依旧,仔细查看信息发现下面这条信息和报错信息很相似。所以做如下修改:

将本地安装好的eclispe发送到另外一台电脑上所出现的问题及解决方法

三、修改bundles.info

    bundles.info部分内容如下:

#encoding=UTF-8
#version=1
bcpkix,1.59.0,file:/C:/Users/zhouy/.p2/pool/plugins/bcpkix_1.59.0.jar,4,false
bcprov,1.59.0,file:/C:/Users/zhouy/.p2/pool/plugins/bcprov_1.59.0.jar,4,false
ch.qos.logback.classic,1.0.7.v20121108-1250,file:/C:/Users/zhouy/.p2/pool/plugins/ch.qos.logback.classic_1.0.7.v20121108-1250.jar,4,false
ch.qos.logback.core,1.0.7.v20121108-1250,file:/C:/Users/zhouy/.p2/pool/plugins/ch.qos.logback.core_1.0.7.v20121108-1250.jar,4,false
ch.qos.logback.slf4j,1.0.7.v201505121915,file:/C:/Users/zhouy/.p2/pool/plugins/ch.qos.logback.slf4j_1.0.7.v201505121915.jar,4,false
com.collabnet.subversion.merge,4.2.0.1,file:/C:/Users/zhouy/.p2/pool/plugins/com.collabnet.subversion.merge_4.2.0.1.jar,4,false
com.fasterxml.jackson.core.jackson-annotations,2.9.2.v20180207-1730,file:/C:/Users/zhouy/.p2/pool/plugins/com.fasterxml.jackson.core.jackson-annotations_2.9.2.v20180207-1730.jar,4,false
com.fasterxml.jackson.core.jackson-core,2.9.2.v20180207-1730,file:/C:/Users/zhouy/.p2/pool/plugins/com.fasterxml.jackson.core.jackson-core_2.9.2.v20180207-1730.jar,4,false
com.fasterxml.jackson.core.jackson-databind,2.9.2.v20180207-1730,file:/C:/Users/zhouy/.p2/pool/plugins/com.fasterxml.jackson.core.jackson-databind_2.9.2.v20180207-1730.jar,4,false
com.google.gson,2.8.2.v20180104-1110,file:/C:/Users/zhouy/.p2/pool/plugins/com.google.gson_2.8.2.v20180104-1110.jar,4,false
com.google.guava,21.0.0.v20170206-1425,file:/C:/Users/zhouy/.p2/pool/plugins/com.google.guava_21.0.0.v20170206-1425.jar,4,false
com.google.guava,15.0.0.v201403281430,file:/C:/Users/zhouy/.p2/pool/plugins/com.google.guava_15.0.0.v201403281430.jar,4,false

    可以看到文件中出现了很多地方用到了.p2目录,故将用户批量替换为新电脑上的用户然后保存。

    再次运行eclipse.exe即可正常打开。