64位系统下同时使用64位和32位的eclipse

64位系统下同时使用64位和32位的eclipse

eclipse.ini 文件使用说明

The -vm option and its value (the path) must be on separate lines.

The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.

The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM.

For the 32-bit Eclipse executable (eclipse.exe on Windows) a 32-bit JVM must be used and 
for the 64-bit Eclipse executable a 64-bit JVM must be used. 
32-bit Eclipse will not work with a 64-bit JVM.

复制代码

要所有的软件,硬件,全是64位的,你的应用才算成功的运行在64位上了。比如:

使用64位的CPU,现在(2006年以后生产)的CPU都是64位。
安装64位的操作系统,比如64位的windows 7
安装64位的JDK,比如jdk-6u25-windows-x64.exe
安装64位的eclipse,比如eclipse-jee-helios-SR2-win32-x86_64.zip

复制代码

 

http://blog.csdn.net/jacarri/article/details/9785683

32位JDK安装目录是D:\Java\32\jdk1.6.0_13

64位JDK安装目录是D:\Java\jdk1.7.0_06

 

JAVA_HOME配置的是JAVA_HOME=D:\Java\32\jdk1.6.0_13

 

然后启动64位的eclipse果断的报错了,报错信息:

[Failed to load the JNI shared library "D:\Java\32\jdk1.6.0_13\bin\..\jre\bin\client\jvm.dll".],

想到环境变量配置的是32位的JDK,果断的确认是eclipse使用了默认的配置,要解决这个问题就要在64位eclipse.ini中指定jvm的位置.

配置方法如下:

  在eclipse.ini文件中找到openFile,在下面添加如下两行:

-vm  
D:/Java/jdk1.7.0_06/bin/javaw.exe  

注意上面两行不能写在同一行上哟.

 

   为了保证以后将环境变量的jdk切换到64位后,32位的eclipse报错,所以顺便32位的eclipse的配置文件也做了类似的配置

  如果改配置后出现这个错误[Java was started but returned exit code=13]  ,可能是你给64位的eclipse指定了32位的jvm.

 

上我64位eclipse使用的配置文件

复制代码

-startup  
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar  
--launcher.library  
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502  
-product  
org.eclipse.epp.package.java.product  
--launcher.defaultAction  
openFile  
--launcher.XXMaxPermSize  
256M  
-showsplash  
org.eclipse.platform  
--launcher.XXMaxPermSize  
256m  
--launcher.defaultAction  
openFile  
-vm  
D:/Java/jdk1.7.0_06/bin/javaw.exe  
-vmargs  
-Dosgi.requiredJavaVersion=1.5  
-Xms40m  
-Xmx384m  
-XX:PermSize=256M   
-XX:MaxPermSize=256M  
-verbose:gc  
-XX:+PrintGCDetails  
-XX:+PrintGCDateStamps  
-Xloggc:D:/application/eclipse-android/gc.log  

复制代码

上32位eclipse使用的配置文件

复制代码

-startup  
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar  
--launcher.library  
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502  
-product  
org.eclipse.epp.package.jee.product  
--launcher.defaultAction  
openFile  
--launcher.XXMaxPermSize  
256M  
-showsplash  
org.eclipse.platform  
--launcher.XXMaxPermSize  
256m  
-vm  
D:/Java/32/jdk1.6.0_13/bin/javaw.exe  
--launcher.defaultAction  
openFile  
-vmargs  
-Dosgi.requiredJavaVersion=1.5  
-Xms40m  
-Xmx512m  

复制代码

  

http://blog.csdn.net/wangxianshou/article/details/7409293

实际上,JDK环境配置好之后,选择一个适合操作系统的Eclipse版本,启动Eclipse就能根据

环境变量自动寻找JDK,并成功运行。

下面是我的弯路历程,总结一下,希望别人可以少走弯路。

 

我安装前手头的环境

=========================================================================

操作系统 win7 64bit

JDK:jdk-7u3-windows-i586

http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u3-download-1501626.html

Eclipse:eclipse-SDK-4.1-win32-x86_64

http://www.eclipse.org/downloads/

=========================================================================

先把jdk安装上,然后设置好java环境后,test没有问题

然后把Eclipse解压开,然后进入Eclipse目录中双击 eclipse 时

启动不开,报 Failed to load the JNI shared library jvm.dll 错误。

网上查阅 http://www.oschina.net/question/12_26790

指点 换成 64位的jdk,就能解决

于是乎,下载64位jdk  jdk-7u3-windows-x64

安装好后,仍然报这个错误,

接下来把之前安装的32位的java环境删掉(开始,控制面板,卸载程序,32位java环境相关软件)

再启动Eclipse,终于正常了。

How to reconfigure eclipse to use a 64 bit JVM

 

I'm using eclipse on what I thought were all 64 bit runtime environments.

The current settings Java>installed JREs and Execution Environment all point to jdk1.6.0_30 which is a 64 bit version of the JDK.

However, eclipse still thinks it's running a 32 bit version because when I run:

System.getProperty("sun.arch.data.model");

 

it returns 32 instead of 64.

And the external JNI resource that I compiled for 64 bit machines will not link to the shared .so file unless it's running in a 64 bit enviroment. (I'm getting word size mismatch errors when I try to do this)

So How can I reconfigure eclipse to run 64 bit jvm. Does eclipse itself have to be a 64 bit version?

:on linux

Edit: I have tried everyone's suggestions and nothing is working. I've changed the execution, and enviroment variables to point to the newst JDK I have which is 1.6_30. when I run the program from a command line I get 64 and amd64 as the value when I run the same program in eclise I get 32 and i386. Something is wrong in eclipse that is causing it to try and run it on a 32 bit JVM. when I try java -d32 -version it says that a 32 bit enviroment isn't installed but Eclipse doesn't know that. I've modified the Eclipse.ini file and still nothing is working. I've restarted eclipse after these changes...nothing. Can some one who knows eclipse well people help me out here. thanks

Add the -vm tag to eclipse.ini or the shortcut to explicitly specify a JRE. Note that the default for Windows XP is to use the CRAPPY JRE that comes with Windows.

-vm "%JAVA_HOME%/bin/javaw.exe"

Note

that the format in eclipse.ini is to have -vm on one line and the value on the next.. I'm not sure why... 

-Xmx8g
-d64

 

The "installed JREs" (better use JDKs) are used for building and running your code

and can be of different architecture or Java version.

The JVM used for running Eclipse is defined in the eclipse.ini file.

You should use the version for the architecture of the JVM.

复制代码

Okay. 
This has been rather headache inducing, but I believe I have a solution. 
After changing the eclipse.ini, Go to your project properties. 
Under the Run/Debug settings, edit the launch configuration for your project. 
Under the JRE tag, click installed JREs. 
When that dialog comes up, click search. 
Go to your program files folder, NOT the x86 one, and let it search for your JREs. 
When the latest comes up, deselect the JRE that was currently selected and select the most recent JRE that it found. 
I renamed mine JRE7-64 just so I could identify a difference. This solved the issue on my end. Good luck

复制代码

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值