As per the official docs,
When using Neo4j Server, JVM configuration goes into the
conf/neo4j-wrapper.conf
file
So set the heap size like below in neo4j-wrapper.conf
file,
wrapper.java.additional=-Xmx4g
On Windows, by default that folder and file won't exist.
See this for a similar issue, you need to create that folder and that file insider your Neo4j installation directory.
You said that Using -Xmx4g results in the error The JVM could not be started. The maximum heap size (-Xmx) might be too large or an antivirus or firewall tool could be blocking execution
.
That error means that when you try to run java process you don't have 4GB free memory at the time of starting JVM. When you say -Xmx4g, JVM process will ask the host OS for 4GB block and reserve it for future use. But as you already have 16gb ram, check if there's any other process that's taking too much memory.