Java Applet: Increase stack size

2019-08-03 22:10发布

问题:

I was writing a small Java Applet in Eclipse to test a recursive algorithm. Since there are quite a lot recursive calls I needed to increase the stack size: -Xss10m This worked.

Then I wanted to test the applet outside of Eclipse with appletviewer. So I wrote the needed html-file MyStuff.html:

<html> 
    <applet code="MyStuff.class" ARCHIVE=myjar.jar height=512 width=512>
        <PARAM name="java_arguments" value="-Xss10m">
    </applet>
</html>

In order to start the applet I compile MyStuff.java: javac -cp ./myjar.jar:./ MyStuff.java and then call the appletviewer: appletviewer MyStuff.html

But it seems that the stack size isn't adjusted because I get an StackoverflowException. Even if I increase the stack to an even bigger size it isn't working. When asking google I only found questions about changing the heap size for applets but I couldn't find someting for the stack size. So is it not possible? - But using Eclipse works fine... Or what am I doing wrong?

EDIT: I found this answer (heap instead of stack): Java Heap Space: Applets But a comment implies that this won't work for appletviewer