title: How to set stack size of main Thread
body: <p>In case of java we have JVM parameter <code>-Xss</code> which sets the stack Size for a particular Thread.</p>
  
  <p>We can set this parameter as JVm argument or specify it in Thread Constructor like:-</p>
  
  <pre><code>Thread(ThreadGroup group, Runnable target, String name, long stackSize)
  </code></pre>
  
  <p>This will allocate a new Thread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group, and has the specified stack size.</p>
  
  <p><strong>But how to set the stack size of main method which is running. Ideally main method is also in itself a thread , so how do we specify its stack size explicitly apart from using <code>-Xss</code> parameter ?</strong></p>