Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Heap Space: Applets
    primarykey
    data
    text
    <p>I had to write a program to work for a 3000*3000 matrix. It was working only up to 600*600.</p> <p>So I ran my program by increasing heap size by <code>java -Xms64m -Xmx1024m &lt;class_name&gt;</code> Because initially the <code>OutOfMemoryError</code> was occurring. That solved the problem.</p> <p>Now this same program is used to plot values in Applets. So I made a package and imported it. But then the same error was coming as you can't <em>run</em> an applet.</p> <p>You can only type <code>javac class_name.java</code> and <code>appletviewer class_name.java</code>.</p> <p>So there was no way I could increase heap size. So I purposely put a <code>main()</code> function...which calculated the values to be plotted(stored in an array).</p> <p>And the applet would print them. And the array was static and global.</p> <p>Then I compiled (<code>javac class_name.java</code>)and ran(<code>java -Xms64m -Xmx1024m &lt;class_name&gt;</code>) and then typed <code>appletviewer class_name.java</code>.</p> <p>But 0,0,0,... got displayed. Basically the default values of int array.</p> <p>As though the <code>main()</code> function never ran. Even though array was global.</p> <p>Ultimately, I just need a <code>main()</code> function... and some variable that stores values and retains them when <code>ppletviewer class_name.java</code> is typed.</p> <p>Is there any way to do this? Or else to increase heap size for applets?</p> <p>Because when I type the logic in <code>init()</code> or <code>paint()</code> function the same error comes (<code>OutOfMemoryError</code>)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload