How you can set the heap size is described in the
documentation. Use the -Xmx... option to set the maximum amount of memory that the JVM will allocate.
But really, instead of just setting the heap size larger,
you should have a look at your code and find out why you are getting an OutOfMemoryError. Does your program really need to allocate so much memory or do you have a bug somewhere in your code?