本文共 4888 字,大约阅读时间需要 16 分钟。
eclipse.ini is the configuration file used to control the Eclipse startup. We can configure Eclipse VM arguments such as JDK to be used (eclipse.ini vm), permgen space, maximum and minimum heap size using Xms, Xmx parameters.
eclipse.ini是用于控制Eclipse启动的配置文件。 我们可以使用Xms,Xmx参数配置要使用的Eclipse VM参数,例如JDK(eclipse.ini vm),permgen空间,最大和最小堆大小。
For windows, it’s in the same directory as eclipse.exe file, as shown in below image.
对于Windows,它与eclipse.exe文件位于同一目录中,如下图所示。
For Mac OS X, it’s found inside the app. So if Eclipse app is in Downloads directory, eclipse.ini file location will be:
对于Mac OS X,可以在应用程序中找到它。 因此,如果Eclipse应用位于“下载”目录中,则eclipse.ini文件的位置将为:
pankaj$ cd ~/Downloads/Eclipse.app/Contents/Eclipse/
You can reach this location by first right clicking on Eclipse app and click on “Show Package Contents” and then in the next window navigate to Contents/Eclipse
directory, as shown in below images.
您可以通过首先右键单击Eclipse应用程序并单击“显示包内容”,然后在下一个窗口中导航到Contents/Eclipse
目录来到达此位置,如下图所示。
Here is the example eclipse.ini file from my default eclipse installation.
这是默认安装中的示例eclipse.ini文件。
-startup../Eclipse/plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar--launcher.library../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.300.v20150602-1417-productorg.eclipse.epp.package.jee.product--launcher.defaultActionopenFile-showsplashorg.eclipse.platform--launcher.XXMaxPermSize256m--launcher.defaultActionopenFile--launcher.appendVmargs-vmargs-Dosgi.requiredJavaVersion=1.7-XstartOnFirstThread-Dorg.eclipse.swt.internal.carbon.smallFonts-XX:MaxPermSize=256m-Xms256m-Xmx1024m-Xdock:icon=../Resources/Eclipse.icns-XstartOnFirstThread-Dorg.eclipse.swt.internal.carbon.smallFonts
Some important points about eclipse.ini file are:
关于eclipse.ini文件的一些重要点是:
eclipse.ini vm argument is useful when you have multiple JDK installation and you want to make sure that your eclipse runs on a specific JVM, rather than picking system configured jdk path. It must be defined before -vmargs.
eclipse.ini vm参数在安装多个JDK并希望确保eclipse在特定的JVM上运行而不是选择系统配置的jdk路径时很有用。 必须在-vmargs之前定义 。
My eclipse.ini file snippet showing -vm argument usage to configure eclipse to use JDK8 in Mac OS X.
我的eclipse.ini文件片段显示了-vm参数用法,用于配置eclipse在Mac OS X中使用JDK8。
-vm/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin-vmargs
You can configure it similarly for Windows or Linux operating systems. Just change the JDK bin directory path accordingly.
您可以为Windows或Linux操作系统进行类似配置。 只需相应地更改JDK bin目录路径。
If you are getting java.lang.OutOfMemoryError: PermGen space
error, mostly when you are working on larger code base, doing maven update for large projects etc. , then you should increase Permgen space. Below is the configuration to increase permgen space to 512 MB in eclipse.ini file.
如果您遇到java.lang.OutOfMemoryError: PermGen space
错误,主要是在使用较大的代码库,对大型项目进行maven更新等时,则应增加Permgen空间。 下面是将eclipse.ini文件中的permgen空间增加到512 MB的配置。
-XX:MaxPermSize=512M
Note that there is no more Permgen space from Java 8 onwards, so setting this option will have no effect. However you will also not get out of memory error because of permgen space.
请注意,从Java 8开始,不再有Permgen空间,因此设置此选项将无效。 但是,由于permgen空间,您也不会出现内存不足错误。
If you are getting OutOfMemoryError related to Heap space, then you can try to increase the maximum heap size available to eclipse. You can easily do it by editing -Xmx value. For example, below snippet will increase the eclipse heap size to 2 GB.
如果您获得与堆空间有关的OutOfMemoryError,则可以尝试增加可用于Eclipse的最大堆大小。 您可以通过编辑-Xmx值轻松地做到这一点。 例如,以下代码段会将eclipse堆的大小增加到2 GB。
-Xmx2048m
That’s all for a quick roundup on eclipse.ini configuration and VM arguments.
这就是对eclipse.ini配置和VM参数的快速汇总。
翻译自:
转载地址:http://ifqzd.baihongyu.com/