您的位置:首页 > 编程语言 > Java开发

如何在eclipse的配置文件里指定jdk路径

2016-07-16 19:09 801 查看
今天下载了eclipse4.6版本,打开时报Version 1.7.0_45 of the JVM is not suitable for this product. Version:1.8 or greater is required.,提示jdk版本要1.8以上,如下图:



由于不想直接将环境变量配置的jdk1.7改为jdk1.8,所以单独在eclipse的配置文件里指定jdk来运行eclipse4.6,方法如下:
打开eclipse根目录下的eclipse.ini配置文件,eclipse4.6默认配置如下:
-startup
plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m

在 -vmargs 前面增加 -vm参数来指定jdk路径,如我的jdk路径在d:\java文件夹下 :
-vm
D:\java\jdk1.8.0_91\bin\javaw.exe


添加 -vm参数后的配置文件如下:
-startup
plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
D:\java\jdk1.8.0_91\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m

然后再次运行eclipse.exe便能正常启动了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: