I receive error message while running App with userA which exceeding 1800Mb heap , but the same App works fine with userB,
That's said, below command works for userA, but for userB there is an error
java -Xmx2048m -jar App
error: Error occured during initialization of VM Could not reserve enough space of VM Could not create Java virtual machine
For userB can you check the free memory available for execution ? This could be done by checking free -m on Linux or you could check what other application/processes are consuming resources using top command.
On windows you could verify with the task manager.