How to configure Java Virtual Machine in eclipse

Source: Internet
Author: User

When running a Java program in eclipse, an outofmemory error is often generated. This error is caused by insufficient memory of the Java Virtual Machine. How to configure Java Virtual Machine memory?

You can use either of the following methods:

1. Directly configure the JRE parameters as follows:

Find eclipse Windows> preference> JAVA> installed jres to view the JRE file used by eclipse. Double-click the installed JRE file to edit the installed JRE file. For example:

The setting affects the memory of the Java Virtual Machine of the project in exlipse.

 

Ii. settings of the current running program

 

The setting of the memory of the virtual machine of the currently running program only affects the current running program, not global.

The procedure is as follows:

Method 1: Right-click the main program class of the running program and choose run> runconfigurations> arguments> vmarguments to set the memory size of the Java Virtual Machine. As follows:

-The xmx parameter is used to set the maximum memory size.
-XMS is the minimum memory used.
The two parameters can be used at the same time or separately.

Method 2: set from the eclipse shortcut key:

Right-click the eclipse shortcut, select properties, and add-vmargs-xmx192m to the target text to set the maximum memory usage for Java Virtual Machine initialization to 192 MB, or set it to another value.

As follows:

2. Set from the project

Right-click the project and choose Properties> JAVA editor> Run/debug settings> double-click the project master program. The configuration editing box is displayed. :

As follows:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.