之前一直用的是32位的Win7,安装的jdk和eclipse也是32位的,前几天换了个64位的系统,刚刚在网上下载的64位的eclipse打开就报错Failed to load the JNI shared library
网上有很多解决这个问题的办法总之就是你的jdk环境和eclipse环境对不上,要么是32位的jre和64位的eclipse,或者是64位的jre用32位的Eclipse.所以我就想当然的将原先的32位jdk删掉了换成64位的jdk.64位的eclipse能用了。但是发现32位的eclipse打开报错jvm terminated. exit code=1。又在网上百度了下这个问题。解决方法是在32位Eclipse目录下修改eclipse.ini文件.但是始终没有成功,后来将jdk还原成了32位的就好了。但是我想32位的Eclipse和64位的Eclipse同时都能运行。因为32位的Eclipse用过很长时间了。里面的配置为也不愿在新版本中改,插件也装了一大把。懒得改了。后来我就同时装了32位的jdk和64位的jdk,网上有文章说同时使用不同版本的jdk,可以写批处理。
最后我的解决办法是将64位的jdk中的jre文件放到64位Eclipse文件的eclipse.exe的同级目录下面,注意jre不要改名之前我的jre6文件名就启动不了。后来改成jre就成功的将64位的eclipse启动了。自己的电脑的环境变量中还是使用的32位的jdk.
因为eclipse本身就是一个java程序,同普通java程序一样需要先寻找jre。会先在自己的同级目录下面寻找jre,如果没有就会去找path里面的。将64位的jre放在他的目录下面让eclipse自己单独使用一个jre即可。