silentdoer

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

转载自:https://blog.csdn.net/gnail_oug/article/details/51925804;个人做了些小修改。

今天下载了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默认配置如下:

 

[plain] view plain copy
 
  1. -startup  
  2. plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar  
  3. --launcher.library  
  4. plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444  
  5. -product  
  6. org.eclipse.epp.package.jee.product  
  7. --launcher.defaultAction  
  8. openFile  
  9. -showsplash  
  10. org.eclipse.platform  
  11. --launcher.defaultAction  
  12. openFile  
  13. --launcher.appendVmargs  
  14. -vmargs  
  15. -Dosgi.requiredJavaVersion=1.8  
  16. -XX:+UseG1GC  
  17. -XX:+UseStringDeduplication  
  18. -Dosgi.requiredJavaVersion=1.8  
  19. -Xms256m  
  20. -Xmx1024m  


在 -vmargs 上一行--launcher.appendVmargs的上一行增加 -vm参数来指定jdk路径,如我的jdk路径在d:\java文件夹下 :

 

-vm
D:\java\jdk1.8.0_91\bin\javaw.exe

添加 -vm参数后的配置文件如下:

 

[plain] view plain copy
 
  1. -startup  
  2. plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar  
  3. --launcher.library  
  4. plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444  
  5. -product  
  6. org.eclipse.epp.package.jee.product  
  7. --launcher.defaultAction  
  8. openFile  
  9. -showsplash  
  10. org.eclipse.platform  
  11. --launcher.defaultAction  
  12. openFile
  13. -vm  
  14. D:\java\jdk1.8.0_91\bin\javaw.exe  
  15. --launcher.appendVmargs  
  16. -vmargs  
  17. -Dosgi.requiredJavaVersion=1.8  
  18. -XX:+UseG1GC  
  19. -XX:+UseStringDeduplication  
  20. -Dosgi.requiredJavaVersion=1.8  
  21. -Xms256m  
  22. -Xmx1024m  


然后再次运行eclipse.exe便能正常启动了。

分类:

技术点:

相关文章:

  • 2022-02-07
  • 2022-01-04
  • 2021-08-09
  • 2022-01-03
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-23
  • 2021-07-17
  • 2021-12-03
  • 2021-12-25
  • 2022-01-02
相关资源
相似解决方案