eclipse.ini vm参数– eclipse.ini文件位置Mac,Windows

本文介绍了eclipse.ini文件的作用,它是Eclipse启动的配置文件,用于设置JDK路径、permgen空间和堆空间。在Mac和Windows中,eclipse.ini文件的位置不同。通过调整-vmargs后的JVM参数,如-XX:MaxPermSize和-Xms、-Xmx,可以解决内存不足问题。对于Java 8及更高版本,不再有Permgen空间,但需要关注堆空间的配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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空间,最大和最小堆大小。

eclipe.ini文件位置 (eclipe.ini File Location)

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
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--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文件的一些重要点是:

  1. Each line before -vmargs contains an option followed by the value for option.

    -vmargs之前的每一行都包含一个选项,后跟option值。
  2. All the lines after -vmargs are passed as JVM arguments, so all options and arguments for eclipse startup must be specified before -vmargs. For example -vm settings for JDK to be used.

    -vmargs之后的所有行均作为JVM参数传递,因此,必须在-vmargs之前指定用于Eclipse启动的所有选项和参数。 例如,将使用JDK的-vm设置。
  3. –launcher.XXMaxPermSize specifies the maximum permgen space to use by eclipse launcher, increase this value if your eclipse startup is failing with out of memory error.

    –launcher.XXMaxPermSize指定eclipse启动程序要使用的最大permgen空间,如果eclipse启动失败并出现内存不足错误,请增加此值。
  4. If you are getting Out of Memory errors, you should try to increase Permgen space and maximum heap space values. They are configured using VM arguments -XX:MaxPermSize, -Xms and -Xmx. Permgen space default value is configured as 256MB that is good for small to medium projects.

    如果遇到内存不足错误,则应尝试增加Permgen空间和最大堆空间值。 使用VM参数-XX:MaxPermSize-Xms-Xmx对其进行配置 。 Permgen空间的默认值配置为256MB,适合中小型项目。

eclipse.ini vm参数 (eclipse.ini vm argument)

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之前定义

eclipse.ini vm参数Mac (eclipse.ini vm argument Mac)

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目录路径。

eclipse.ini彼尔姆根空间 (eclipse.ini Permgen Space)

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空间,您也不会出现内存不足错误。

eclipse.ini堆空间 (eclipse.ini Heap Space)

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参数的快速汇总。

翻译自: https://www.journaldev.com/10882/eclipse-ini-vm-arguments-file-location-mac-windows

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值