Skip to content

Can Eclipse run with Z Garbage Collector?

I tried to change from -XX:+UseG1GC to -XX:+UseZGC in eclipse.ini

[email protected]/eclipse-workspace

When I tried to run terminal in eclipse to show default GC in used, I found that the eclipse still using -XX:UseG1GC mode instead. Can someone help on this issue?

Microsoft Windows [Version 10.0.19042.804]
(c) 2020 Microsoft Corporation. All rights reserved.

C:eclipseworkspacetestProgram>java -XX:+PrintCommandLineFlags -version
-XX:ConcGCThreads=2 -XX:G1ConcRefinementThreads=8 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=263203904 -XX:MarkStackSize=4194
304 -XX:MaxHeapSize=4211262464 -XX:MinHeapSize=6815736 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+Segmented
CodeCache -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC -XX:-UseLargePagesIndividualAllocation
openjdk version "15.0.1" 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9-18)
OpenJDK 64-Bit Server VM (build 15.0.1+9-18, mixed mode)


The eclipse.ini settings are just used for Eclipse itself, they don’t change anything else. To see what Eclipse is using open the “Help > About” dialog (“Eclipse > About” on macOS), click the “Installation Details” button and look at the “Configuration Tab”.

For Java programs you run from within Eclipse using the ‘Run’ command the ‘Run Configuration’ sets what is used. See the ‘VM Arguments’ section of the ‘Arguments’ tab.

You can set default VM arguments for a JRE/JDK in the ‘Java > Installed JREs’ page of the Preferences.

None of the Eclipse settings changes the options for a ‘java’ command you run from a terminal.