How can I specify the default JVM arguments for programs I run from eclipse?

JavaEclipseJvm

Java Problem Overview


Is there a way to specify default JVM arguments when I'm running my code from eclipse, rather than specifying the same ones over and over for each run/debug/etc configuration?

Java Solutions


Solution 1 - Java

Go to Window → Preferences → Java → Installed JREs. Select the JRE you're using, click Edit, and there will be a line for Default VM Arguments which will apply to every execution. For instance, I use this on OS X to hide the icon from the dock, increase max memory and turn on assertions:

-Xmx512m -ea -Djava.awt.headless=true

Solution 2 - Java

Yes, right click the project. Click Run as then Run Configurations. You can change the parameters passed to the JVM in the Arguments tab in the VM Arguments box.

That configuration can then be used as the default when running the project.

Solution 3 - Java

As far as I know there is no option to create global configuration for java applications. You always create a duplicate of the configuration.

enter image description here

Also, if you are using PDE (for plugin development), you can create target platform using windows -> Preferences -> Plug-in development -> Target Platform. Edit has options for program/vm arguments.

Hope this helps

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionThomas JohnsonView Question on Stackoverflow
Solution 1 - JavaAlice YoungView Answer on Stackoverflow
Solution 2 - JavaJivingsView Answer on Stackoverflow
Solution 3 - JavaRaviView Answer on Stackoverflow