Error: code too large for try statement, when compiling a big java file.

Hi,
I have a big java file ( around 16000 lines). When compiling it, I got following error message:
MyMain.java:15233: code too large for try statement
} catch ( Throwable t ) {
In MyMain.java, I just repeat following statements about 1000 times.
try {
if ( year >= 2002 ) {
System.out.println( "year: Evaluation version is not valid" );
} else {
System.out.println( "year: Evaluation version is still valid" );
} catch ( Throwable t ) {
if ( year >= 2002 ) {
System.out.println( "year: Evaluation version is not valid" );
} else {
System.out.println( "year: Evaluation version is still valid" );
I tried 1.3 and 1.4 javac compiler, there was some error.
How to make compiler to compile this code?
Thanks,

Hi,
I have a big java file ( around 16000 lines). When
compiling it, I got following error message:
MyMain.java:15233: code too large for try statement
} catch ( Throwable t ) {
I tried 1.3 and 1.4 javac compiler, there was some
error.
How to make compiler to compile this code?
You don't. Each method has an absolute limit on the number of byte codes. You have reached that limit. The limit is part of the specification and JVMs will refuse to run classes that exceed the limit. So even if you could compile it, it wouldn't run.
It is quite common for code generators to generate large monolithic blocks of code. Presumably this is how you got to this spot. Modify the code generator to break it into smaller blocks.
If you did it manually then you did it wrong. And you will have to manually break it into smaller blocks. (And re-examine your design since it is probably wrong.)

Similar Messages

  • Error in jsp:Code too large for try statement

    Hi friends,
    When i try to run a jsp program i am getting error "code too large for try statement". How can i rectify it rather than truncating that jsp? is there another way?
                                                  Basha

    Basha,
    When we were implenting an e-form component which was very big, the only way we were able to achieve it was by
    "jsp includes". In the main form simply included muliple
    jsp pages, where each was a section of the e-form.
    we have not found any other better way.
    Hope this helps.
    -Venkat Malempati
    Message was edited by: Venkat Malempati
    Message was edited by: Venkat Malempati

  • How do you avoid a code too large for try statement error message while com

    i have the jsp which is having 142 fields
    i am trying to dispaly 142 fields its showing the above error
    at runtime
    i think JVM is not allowing to complie the jsp
    please any body give me the solution for it

    I've got the same error with Weblogic 8.1 .
    When I tried to visit a JSP I wrote, which had many tags, the page showed the error: code too large for try statement.
    I'v reviewed a lot of discussions through the internet and solved the problem at last by adding one parameter to weblogic.xml.
      <jsp-descriptor>
         <jsp-param>
              <param-name>noTryBlocks</param-name>
              <param-value>true</param-value>
         </jsp-param>
      </jsp-descriptor>Hope this may help you out.

  • 500 Internal Server Error OracleJSP: code too large for try statement catch

    We have an application which uses JSPs as front end and we are using Struts 1.1. When we run one of the JSP it shows the following error after executing .We are using OCJ4 server having version 9.0.4.0
    500 Internal Server Error
    OracleJSP: oracle.jsp.provider.JspCompileException:
    Errors compiling:E:\oracle\product\10.1.0\AS904\j2ee\home\application-deployments\VAS3006\vas\persistence\_pages\\_Requirement .java
    code too large for try statement catch( Throwable e) { 
    7194
    code too large for try statement catch( Exception clearException) { 
    44
    code too large for try statement try { 
    23
    code too large public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { 
    The JSP/application runs okay on one machine (System Tesing machine)with OCJ4 server having version10.1.2.0 but throughs an error on other machine( Development machine)with OCJ4 server having version9.0.4.0.The question is why it is running on one machine ane giving error on other machine I am aware that there can't be more than 64kB of code between try-catch block .Total size of the generated JSP class in our case is 577KB.
    Is the problem because of different version of Application server OC4J?.Is it any fix for this? Or Can anyone please suggest a work around. Or is there a method by which the JSP generated code is split between different try - catch blocks rather than a single try-catch block.Utlimately We don't know the whether is it a problem with JVM or hardware .
    It would be really helpful if you would provide me with some suggestion and input.
    Regards
    Shyam

    Sir,
    I am aware of the limitations of JVM that it won't allow java code more than 64Kb in method but we are using different versions of Application server .Application is working okay with OC4J application server(10.1.2.0) but gives error on Application server with version 9.0.4.0. Is this a problem with OC4J application server 9.0.4.0. I had gone through the documentation ofOC4J 9.0.4.0.application server but it does not mention about the this bug/fixes.
    Please giude me on the same.
    Regards,Shyam

  • Code too large for try statement

    I have a jsp that I am getting the following exception on.
    [ServletException in:/jsp/DLG_PTEN.jsp] Unable to compile class for JSP C:\Documents and Settings\ebsgam\My Documents\IBM\wsappdev51\workspace\StnWeb\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\DefaultEAR\StnWeb.war\jsp\_DLG_5F_PTEN.java:13576: code too large for try statement } catch (Throwable t) { ^ C:\Documents and Settings\ebsgam\My Documents\IBM\wsappdev51\workspace\StnWeb\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\DefaultEAR\StnWeb.war\jsp\_DLG_5F_PTEN.java:1165: code too large for try statement try { ^ 2 errors '
    I am currently running this on Websphere Aplication Developer 5. First off I'm hoping that this error will go away when it is deployed to tomcat. But I wanted to see if anyone has had this problem and knows of a tweek or work around for it.
    The jsp in question is not the longest one I have... but it has a large number of drop down list boxes .. using jstl <select><option>. and the drop downs have around 40 or 50 items in them.

    in weblogic 8.1, i've met the same error, and solved the problem by adding param to weblogic.xml , like below:
      <jsp-descriptor>
         <jsp-param>
              <param-name>noTryBlocks</param-name>
              <param-value>true</param-value>
         </jsp-param>
      </jsp-descriptor>

  • Code too large for try statement - help :(

    Please help :(
              We are migrating our project from an older technology, Kiva from netscape
              (and about time we migrate) . Kiva uses template evaluation similar to
              jakarta velocity. So the fastest way we found was to translate kiva
              templates to JSPs via perl script. All is working fine except a bunch of
              JSPs which are too large for the compiler to handle. If we were not
              migrating and instead wroking from scratch we would have simply made the
              JSP's size smaller and used jsp:include, but in this case it will involve a
              lot of effort as that means changing a lot of business code.
              Basically what we get is "code too large for try statement". Is there anyway
              we can tell weblogic to put smaller code fragments in try/catch when it
              converts a JSP into java code.
              

              Haider,
              Have you seen the following Sun Bug Parade posting
              http://developer.java.sun.com/developer/bugParade/bugs/4210912.html
              Additionally, you may want to try the '-noTryBlocks' jsp compiler switch and see
              if it makes a difference
              See the following 6.1 URL
              http://edocs.bea.com/wls/docs61/jsp/reference.html#57805
              Chuck Nelson
              DRE
              BEA Technical Support
              

  • Compilation Error Code too large for Try block

    I am getting error while jsp compilation.
              code too large for try statement.
              Can anybody help me in this. I am using WL 8.1.4
              Thanks in Advance
              Himanshu

    This article pretty much sums it up: http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_20711819.html
              Your JSP_.java file will not compile to a .class file since the JSP is too large and the newer java compiler is more strict. You have to most likely break your JSP up using includes or use a more efficient design.

  • JSPX: code too large for try statement try

    I'm migrating an application from Tomcat 5 to OC4J 10.1.3.2 and I'm getting the following error in a JSPX file.
    8770
    [jsp src:line #:931]
    code too large for try statement try { 
    This isn't an issue in Tomcat because of the way jasper creates the .java file. OC4J creates one really long _jspService method.  Is there anything I can do short of rewriting the page to fix this?  Let me know if further information is required.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    I have created bug 6152265 to track this.

  • Oracle JSP Exception code too large for try block

    My jsp is exceeding the memory limit (64KB for Oracle 10g App server i think its the JVM limit),
    so it is throwing exception ,code too large for try block,how to over come this,I cant minimize the use of logic tags because it is business requirement.please help me out.

    I think you need to give a value to the attribute buffer in the <%@ page%> directive to solve the problem.
    There will not be any need of going for pagination then.
    buffer="none | 8kb | sizekb"The buffer size in kilobytes used by the out object to handle output sent from the compiled JSP page to the client Web browser. The default value is 8kb. If you specify a buffer size, the output is buffered with at least the size you specified.
    check the documentation at
    http://java.sun.com/products/jsp/tags/11/syntaxref11.fm7.html
    Uday

  • HELP!!! Error "code too large"

    Hello, I am working on a program that has become very large... and apparently it is too large now...
    When I try to compile the program it generates an error, "code too large", the code has exceeded 10000 lines and now I dont know what to do. Anyone that has any ideas? Thankful for any response...

    Let's say, for instance, that I wnat to initialize an array instance variable that will contain 7462 integer values in my constructor, just as an example. I'm not really sure if this exceeds the maximum size for a java array, but if it does that would be just as useless a restriction as this "code too large" thing. If I write huge code that means I need huge code. [ goes to write program in C, which would be my advice here.  :) ]

  • Jdeveloper Error: "Code too large"

    Hi all,
    While running a page in Oracle Jdeveloper 10g, I am getting compilation error “Code too large” on ‘processformrequest’ in controller. I tried the below steps from metalink, but I am still getting the error message.
    1.     Try to compile your page with the standard "javac" Java compiler instead of the "ojc" Java
    compiler, as it generates methods a bit smaller.
    2.     Change the compiler used by the Embedded OC4J:
    2.1) Go to "Tools" -> "Embedded OC4J Server Preferences..."
    2.2) Under "Global" select "Java Compiler"
    2.3) Select "javac" from the "Compiler" list
    2.4) Then under "Bin Directory", point to the location of the javac compiler
    (usually in the JDK bin directory).
    Please let me know if there is any way to resolve this error.
    Thanks in Advance,
    Saravana

    Hi Saravana,
    Please post this in OAF forum(OA Framework
    ~Vikram
    Edited by: Vikram K on Jul 27, 2009 11:00 AM

  • Error :Value Too large for DEF_VALUE of SNP_REV_COL

    I am getting the following error while I am importing my work repository .
    Error : Value Too large for DEF_VALUE of SNP_REV_COL
    Can any one pls let me know the root cause of the issue.
    I found the following work around to resolve the issue.
    I am changing the 'DEF_VALUE' column length in both 'SNP_REV_COL' and 'SNP_COL' tables.
    I am using the ODI 10.1.3.5 version.
    alter table SNP_REV_COL modify DEF_VALUE VARCHAR2 (400);
    alter table SNP_COL modify DEF_VALUE VARCHAR2(400);
    I am able to import the work_rep with out any issues after changing the above columns.
    I am looking for the reason why this issues is occurring.
    Thanks,
    Yellanki
    Edited by: Yellanki on Feb 7, 2011 3:18 AM

    Ankit,
    I am trying to move my Dev WR to Test. And my Source Technologies are SQL Server and Oracle.
    Target is Oracle. I got the work around for this issue And I am looking for the root cause of the issue.
    Any help is greatly appreciated.
    Thanks,
    Yellanki

  • Private void initComponents(){} Error - Code too large

    I am doing java project using netbean 6.5. It has frame contaning a jtabbedPane.
    This tabbed contain 10 tabs.Each tab has contain of labels,textboxes,option button...etc.
    my private void initComponents() method has all most 5000 code line.problem is when i try to
    add more components in to tabbed it won't compile & gives private void initComponents(){} - Code too large error.
    How can i escape from this?
    Can anyone HELP me?

    Delete that garbage and hand code it. Create individual classes for the panels you add to JTabbedPane.
    BTW: you shouldn't use an IDE/Gui builder if you don't know how to do it youself.

  • Error: value too large for column ?!?

    I use LKM SQL to Oracle and IKM Oracle Incremental Update. When I execute the interface I get an error message:
    12899 : 72000 : java.sql.BatchUpdateException: ORA-12899: value too large for column "SAMPLE"."C$_0EMP"."C4_EMP_NM" (actual: 17, maximum: 15)
    I checked the source and maximum length is 15 and I don't understand where ODI can find 17 characters. Both columns (source and targer) are Varchar2(15).
    Then I replaced the mapping with Substr(EMP_NM,1,15) to make sure ODI will get only 15 characters in stage area but... it didn't work. I tried even Substr(EMP_NM,1,10) but no luck.
    Why this ODI error occurred ? It doesn't have any sense....

    It didn't work.
    After I changed length of that column of the source datastore (from 15 to 16), ODI created temporary tables (C$ with I$) with larger columns (16 instead of 15) but I got the same error message.
    I'm wondering why I have to extend length of source datastore in the source model if there are no values in the source table with a length greather than 15....
    Any other idea? Thanks !

  • I get an error message File too large for formatted drive when trying to copy a large video file (~50GB) to a new 64 GB USB drive.  Any thoughts?

    I am copying from a MAC to the new drive - not sure the format of the USB drive, whatever the SANDISK Cruzer is default formatted to..

    You state that Cruzer is formatted which is proably FAT32. FAT32 has limits on file size of 4 GB.
    Since you are copying larger files then you will need to reformat.
    Allan

Maybe you are looking for

  • Can Intermedia Help Me

    Hello Gurus, We have a application runs two times a day , which fetches data from a remote server. We have a table in which we store URL to access a finance document which is in TIFF format. What we have to do is to get the finance document in to one

  • Understanding is important

    Hi   Today Morning I saw a very interesting thread where I have found the reply was irrelavant to the issue , and thanks to moderators wooooo, [aaiigoooooo|Method in se24; And I felt that people start giving replies by simply seeing at the keywords i

  • Need to stop irrelevant input into inbox / how to do a REAL filter?

    I finally found the User Manual. This should be put up at the head of the website - not hidden away. It was recently posted. I didn't know it existed. I discovered it by accident. Some of the stuff in the User Manual is confusing and not well or comp

  • Database problem want to solve using oracle.

    I am new to database managemnt so kindly coordinate. I have a database in excel (employees name, address)and its relational . now i have another database(employees ID ,number) which is relational in sense to first database. I want to link those two d

  • What is the maximum number of files that Finder can display in a directory?

    When displaying systems in an Active Directory domain, Finder only displays some of the systems. I presume that Finder is treating the list of SMB/CIFS systems as if they were entries in a file directory. The number of systems that should appear in t