On Thu, 6 Mar 2003, Davor Cengija wrote:
> Date: Thu, 06 Mar 2003 08:09:53 +0100 > From: Davor Cengija <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: Re: [OT] Java method size limitations > > Becky Norum wrote: > > > This is FYI - it was an issue that came up when someone (not me!) had an > > 8500 line Java source file. He got a "code too large for try statement" > > exception during compilation, which puzzled even some long term Java > > programmers. > > > > Apparently, there is an upper limit of 64K (compiled) on java methods. > > (see > > > http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#154) > > > > The Java method bytecode code length is defined as an int (32-bit), but > > exception start/end blocks are defined by shorts (16-bit). This limits > > the method length to 2^16=64K. > > > > Hopefully, noone on this list will ever write a class that large, but in > > case you ever run across this.. > > > > I had that problem in a compiled JSP page (therefore, in the created > servlet): a table with 150 rows and 8 <bean:write /> columns (some > financial data). > > The solution was to split the table into 3 files and in the first one just > included the second and the third using <jsp:include />. Now it works just > fine. You might also be assisted by updated JSP page compilers that do not put the entire page into a single method. For example, the Jasper2 compiler in Tomcat 4.1.18 takes care of this -- it splits your page into multiple methods as long as you are not using scriptlets. (As an extra added benefit, the compiled pages run *much* faster than older Tomcat versions also :-). > -- > [EMAIL PROTECTED] > Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]