StackOverflowException compiling 8000 source file

I am trying to compile a source file with ~8000 lines. It has many (hundreds) of static members (instances of that class), and methods containing conditional statements to take a string and return the instance of that name. This is generated code, so I do not think I can change it.
Every time I try to compile it with Maven (Sun JDK 1.4.2_05) I get a java.lang.StackOverflowException. I have tried giving Maven more stack memory via the -Xss option (as much as 10m per thread), but that didn't help at all.
I commented out 90% of the code and it works fine, so I know it is the size that is the problem.
Has anyone had to deal with something like this before? If so, how did you fix it?

Thank you to everyone who has replied. After some experimentation I discovered that the problem is not the 800+ static objects being created - it was the 1000's of lines of nested conditional statements. The generator has been modified to make if, if, if... instead of if, else-if, else-if, ... and all is well. :)
I do not believe any sort of hard limit was reached, b/c Eclipse had no problem with the file. Also, one of our projects has a source file with 12k lines, and it works fine (though it has a different structure).
I find it interesting that people are being so critical about the generator, especially since this is only one small piece of its modelling. The generator does far more than just create the key types and values.
Furthermore, I don't understand the criticism of the code as-is. No, it's not something I'd write myself, nor would I wish to maintain such code - but no one has to! That's what the generator is for. If I want to add or delete a key type/value, I do so in the generator, and then regenerate the code.
I also don't understand why anyone thinks this code is not object-oriented. Perhaps I just didn't explain it well. All classes representing key types extend AbstractDiscreteValue, so there's inheritance. The reason why all the values exist as static (and final) instances is b/c we never need more than one instance of each value, the values are known at generation time, and all instances are immutable.
How would any of you construct such a class? Keep in mind that maintenance is not an issue, and most key types (probably 95% or more) have fewer than a dozen values.
Anyway, thanks again for the help.

Similar Messages

  • Java.lang.NoClassDefFoundError when compile SQLJ source file

    Always got error message java.lang.NoClassDefFoundError: sun/io/CharToByteConverter
    when using sqlj to compile SQLJ source file.
    The CLASSPATH (partial) .:$ORACLE_HOME/sqlj/lib/translator.zip:$ORACLE_HOME/sqlj/lib/runtime.zip
    I am able to compile the demo TestInstallCreateTable.java and TestInstallJDBC.java but not TestInstallSQLJ.sqlj in the same directory.
    I am using Oracle 8.1.6 R2 client in Linux Intel on Red Hat 6.0. Can anyone explain why this happened ?

    From the forthcoming new version of the SQLJ FAQ:
    "NoClassDefFoundError: sun/io/CharToByteConverter"
    (This is likely a general configuration issue, not something specific to your code.)
    Running sqlj results in the following error message.
    java.lang.NoClassDefFoundError: sun/io/CharToByteConverter
    at sqlj.tools.Sqlj.initializeErrors(Sqlj.java:519)
    This happens if you are running under a JRE environment, and not a full JDK environment. You need to download and install a full JDK environment. Note that the Oracle
    database installation will only set up a Java Runtime Environment. Oracle does not distribute the Java Development Kit - you have to get it from http://java.sun.com
    If that did not help, you'd need to give us a fuller picture of your environmnet (JDK versions, PATH, CLASSPATH settings, etc.).
    Thanks!

  • Compile multiple source files

    sorry, this is maybe a newbie question.
    but iI have a problem compiling an application that use multiple sources files
    for exemple
    the class A is in the file 1
    the class B is in the file 2
    class A uses an instance of the class B
    class B uses an instance of the class A
    so i'm unable to compile these files coz each one tells me he doesn't know about the other
    Is there a way to define prototypes of class or fonctions before their use like in C/C++?
    Or is there another way i didn"t pay attention
    thanks all

    This is a minimal explanation of packages. For a full explanation of packages and how to compile and run Java programs, see this page:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/tools.html
    and read the Setting the Classpath and the How Classes are Found topics.
    Assume that your programs are part of a package named myapp, which is specified by this first line in each source file:
    package myapp;
    Also assume that directory (C:\java\work\) is listed in the CLASSPATH list of directories.
    Also assume that all your source files reside in this directory structure: C:\java\work\myapp\
    Then a statement to compile your source file named aProgram.java is:
    C:\java\work\>javac myapp\aProgram.java
    And a statement to run the program is:
    java myapp.aProgram
    (This can be issued from any directory, as Java will search for the program, starting the search from the classpath directories.)
    Explanation:
    Compiling
    A class is in a package if there is a package statement at the top of the class.
    The source file needs to be in a subdirectory structure. The subdirectory structure must match the package statement. The top subdirectory must be in the classpath directory.
    So, you generate a directory structure C:\java\work\myapp\ which is the [classpath directory + the package subdirectory structure], and place aProgram.java in it.
    Then from the classpath directory (C:\java\work\) use the command: javac myapp\aProgram.java
    Running
    Compiling creates a file, aProgram.class in the myapp directory.
    (The following is where people tend to get lost.)
    The correct name now, as far as java is concerned, is the combination of package name and class name: myapp.aProgram (note I omit the .class) If you don't use this name, java will complain that it can't find the class.
    To run a class that's NOT part of a package, you use the command: java SomeFile (assuming that SomeFile.class is in a directory that's listed in the classpath)
    To run a class that IS part of a package, you use the command java myapp.aProgram (Note that this is analogous to the command for a class not in a package, you just use the fully qualified name)

  • Stuck with compiling a source file

    Hi,
    I'm stuck with this strange problem and i desperately need some help.
    My source file is in the D drive inside the package named objectwrite. The source file X.java is extending an abstract class named Y. When i'm trying to compile the files using the command javac objectwrite\ x.java y.java from D drive, it's giving the follopwing error
    javac: invalid flag: ObjectWrite/
    Looking forward for the solution
    Thnks
    Rompom_1

    You have a space between '\' and 'x'

  • Failed to compile J2EE source files

    Hi all, I'm learning J2EE these days. When I followed the tutorials on how to compile source files,
    eg. 1. In a terminal window, go to the j2eetutorial/examples directory.
    2. Type the following command:
    ant converter
    I got a message with title "16 bit MS-DOS Subsystem" and content
    "C:\WINDOWS\system32\ntvdm.exe
    Error while setting up environment for the application. Choose 'Close' to terminate the application."
    Could anyone tell me what's going on?
    Thanks very much

    The documentation on the javac command has information on the options it provides:
    [http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html]
    Otherwise you could use a tool like Ant to manage the build.

  • I cannot compile "C" source file on Mac OS X(10.8.2)

    Hi,
    I am trying to compile the C source filein terminal, using "cc" or "gcc" command. No luck.
    Later on, tried to ran the command, xcrun cc filename.c, the compiler gave an error about header files.

    I have tried with /bin/cc and /usr/bin/cc  and tried to find the "CC" command  or "gcc" command or "C++" or "g++" command in the directories. No luck!
    echo $PATH
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
    I have checked the cc binaries in all of the above directories. No luck

  • Problem compiling source file in package

    Hi, I have 5 source files which I have just packaged together and put in the same sub-directory, the problem is that when I try to compile the file with the main method I get the error message:"cannot read" then the name of the source file. I am compiling from the command line and setting the classpath as I compile with the statement:
    c:\j2sdk1.4.1\bin>javac -classpath c:\directory\package directory source file.java
    I'm not sure what I am doing wrong and the source files all compiled fine before I added the package statement to the files. Please any help would really be appreciated.

    It sounds like the java file your are trying to compile is not in the directory you are compiling from.
    Is this basically what you are doing?:
    Say the package name is mypackage.
    Assume we are O.K. with keeping source and class files together.
    Create a directory named 'mypackage' somewhere...C:\mypackage\.
    Put all the .java files in it (these .java files indicate that they are a member of the 'mypackage' package).
    At a command prompt, cd to the directory containing the 'mypackage' directory...'cd C:\'
    Compile the source files: C:\j2sdk1.4.1\bin\javac mypackage\*.java
    run the main class: C:\j2sdk1.4.1\bin\java mypackage.TheMainClass
    Basically, this says keep the files where you want them and point to javac, instead of moving everything under java/bin. btw it will save a lot of typing if you add java/bin to your PATH.
    Hope this helps.

  • Compile source files from multiple subdirectories

    Hi. we know that we can compile multiple source files in a folder with the statement:
    javac -classpath . *.java
    How can we compile multiple source files that belong to different subfolders without using an IDE?
    Example:
    folder1, folder2, & folder3 all have .java source files, and all 3 folders belong to a folder named bigfolder;
    what is the shortest way to compile those source files in one statement like the one above?

    It should work withjavac -classpath your_classpath folder1\*.java folder2\*.java folder3\*.javaJust make sure that your_classpath allows all of the classes to be found.
    It might be better to use the -d option in your case.javac -d path_for_classes folder1\*.java folder2\*.java folder3\*.javaYou just specify the directory into which the .class files and their package directories should go.

  • Do we have to separate java source files and class files after compiled..

    Hi,
    I really confussed with this:
    I have compiled java source files into a package and tried to use but the classes can not be found. Should I separate class and source files after compiled with packages names. I hope you understand what i mean.
    Thank you
    So Jag

    You can choose to separate the source files or not. It sounds like your problem has to do with Classpath and packages.
    If the file c:\base\compute\engine\mysourcefile.java starts with the statement "package engine;" then the fully qualified name of the class is is engine.mysourcefile. If the file c:\base\compute\client\mysourcefile.java starts with the statement "package client;" then its fully qualified name is client.mysourcefile.
    In your source files, whenever you refer to a class from another class, the compiler needs the fully qualified class name. You can either import the class or use the fully qualified name. In order for the compiler to find the class, the c:\base\compute directory must be in the Classpath (assuming the package definitions from above).
    Finally, to launch an application given the above, the command would be "java client.mysourcefile" assuming the main method is in client.mysourcefile.

  • Error when compiling the J2ee tutorial source files

    HI,
    I have installed ant, j2ee tomcat-3.2.2 and jdk1.3 and when i tried to compile the source file downloaded from java.sun by
    ant converter, it prompted
    "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/main"
    I am running it on win98 with the autoexec.bat containing the followings:
    set J2EE_HOME=c:\j2sdkee1.3
    set JAVA_HOME=c:\jdk1.3.1
    set ANT_HOME=c:\jakarta-ant-1.3
    set TOMCAT_HOME=c:\tomcat\jakarta-tomcat-3.2.2
    set classpath=;.;c:\jdk1.3.1\jre\lib\rt.jar;c:\j2sdkee1.3\lib\j2ee.jar;c:\jaxp\xalan.jar;c:\jaxp\crimson.jar;c:\jaxp\jaxp.jar;c:\C:\jakarta-ant-1.3\lib\ant.jar;C:\jakarta-ant-1.3\lib\jaxp.jar;C:\jakarta-ant-1.3\lib\parser.jar
    PATH=%PATH%;"C:\Program Files\Mts";C:\PROGRA~1\ULTRAE~1;c:\jdk1.3.1\bin;c:\j2sdkee1.3\bin;c:\jakarta-ant-1.3\bin;C:\PROGRA~1\MICROS~4\80\TOOLS\BINN
    Really thx for help !!!!

    Hi.
    I am compiling the sample converter.ear downloaded from
    the j2ee tutorial bundle form java.sun. I am using jakarta-ant-1.4alpha-bin.zip downloaded from jakarta
    oh..yes it should be org.apache.tools.ant.Main ....sorryfor typo.....
    look forward to any helpful reply

  • Compiling source files in directory separate from JDK

    I'm trying to switch from Visual Cafe to a more agnostic platform: just using a text editor and then compiling and running with Sun's JDK. The problem is that I can't actually get my programs to compile and produce class files. I suspect a Classpath or directory structure problem, but I don't know how to attack this.
    I am running Windows 2000, and the JDK is sitting at C:\j2sdk1.4.0_01. I'm keeping my source files at in a separate directory at E:\New_Java_Files. When I try to compile a source file in this directory, I don't get the resulting class files even though it compiles (that is, javac does not give any errors). On the other hand, when I compile the "Hello World" app in this same directory, it does produce a class file and then I can run it.
    Any suggestions?
    Thanks, Yao

    If javac is actually running, and you don't tell it to stick your files somewhere else, it should create .class files in the same directory as the .java ones.
    My guess:
    Since javac succeeds, either the .class files end up in some other location, or you're somehow compiling a different version of your file in a different location. Try searching for any instances of yourclass.class

  • Encoding of java source files

    I've sucesfully compiled java source files (*.java files) over a lot of different encodings (ANSI, Unicode, UTF8, etc). My IDE (Eclipse) has Cp1252 as default on WIndows OS.
    There is an 'official' encoding for source files ?

    Short answer is Unicode -but that's not enough.
    From Java Language Specification:
    "Except for comments (�3.7), identifiers, and the contents of character and string literals (�3.10.4, �3.10.5), all input elements (�3.5) in a program are formed only from ASCII characters (or Unicode escapes (�3.3) which result in ASCII characters). ASCII (ANSI X3.4) is the American Standard Code for Information Interchange. The first 128 characters of the Unicode character encoding are the ASCII characters."
    There's more that applies, I'll not quote it, read chapter 3 of JLS for details.
    http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html

  • *Added* code to existing source file, compiled it, and class file shrunk

    Another newbie here. Fortunately, my classpath is ok, so I'm able to compile a .java file.
    I added one line of code (System.out.println) to write the value of a variable to a log. After compiling with javac, I noticed that the resulting [new] class file was smaller than the existing class file. I looked at each of the class files with Textpad. It's gibberish, but I quickly saw that a large block of code was missing in the new class file, even though the size of the source file had been increased.
    There is a difference, however, between how the two class files were created. The existing class file was compiled (along with many others) by exporting an .EAR file from a development environment (WSAD) to the WebSphere Administrator Console. Conversely, I am now compiling the same source file with javac on my machine.
    I suspect that this is the reason why I can add code to a .java file, compile it, and have the resulting class file actually lose code. Even if I am correct, I don't know what to do about it.
    Does anyone have an idea?
    Regards,
    Daniel T.

    Thank you both for your replies. I've read many posts over the past few months, and I know how important it is to provide as much info as possible, when asking a question here. That said, I have another tasty tidbit...
    After replacing the existing (larger) class file with the new (smaller) class file, my application now produces this:
    "*Error 500: LinkageError while defining class*..." [name of class]
    *"...(Unsupported major.minor version 50.0) This is often caused by having a class defined at multiple locations within the classloader hierarchy. Other potential causes include compiling against an older or newer version of the class that has an incompatible method signature. Dumping the current context classloader hierarchy: ==> indicates defining classloader ==>[0] com.ibm.ws.classloader.CompoundClassLoader@6bd156d5 Local ClassPath:"*
    ...[the entire classpath]...
    Original exception--- java.lang.UnsupportedClassVersionError:
    I'm guessing that my focus should mostly be on the 'Original exception', and maybe I need to revisit the JRE or JDK or JVM (these terms are somewhat nebulous to me, so please forgive me using them interchangeably) on my machine. For now, I'll just keep trying stuff. Thanks again for the replies!
    Regards,
    Daniel T.

  • Finding errors in a Coldfusion source file at compile time

    My application is built using Coldfusion, Flex and MySQL as backend. I am using FlexBuilder 3 for editing/compiling the Flex source(MXML and Actionscript) files. For the Coldfusion(CF) source files(cfm and cfc files), I am using Coldfusion Builder to edit the source files since it is an IDE for Coldfusion so using that I can see the CF syntax highlighted and text which is commented. After, I complete editing the Coldfusion source files in Coldfusion Builder I close them in CF Builder. Then, the application is compiled using the Flex Builder, but I cannot see any syntax errors if they exist in the Coldfusion source files and I learn of the errors at run time that there is a tag nesting error.
    After, I edit the Coldfusion source files I close them in CF Builder so that Flexbuilder can compile the project and there is no issue of CF source file being locked due to being open in CF builder.
    1. What can I do to ensure I see the CF errors at compile time?
    2. Is there a better/another method than what I am doing to work on a project which has Flex/CF source files?
    Any advice would be appreciated.
    Thanks

    While you are 'compiling' your application since it has a FLEX front end that is compiled.  This actually does nothing with the ColdFusion files, or at least I can't imagine what it would be doing with those files.
    CFML is just-in-time compiled at run time.  And I do not believe using it in a Flex builder application would change this.
    What I would do in this situation is develop the back-end and front-end separately.  Build the CFML, test it with simple test cases run through direct browser requests of the CFML or some test harness CFML that executes your back-end logic and runs it through it paces.  Once that is built and tested.  Then attach the FLEX front end to it and test that.

  • Cannot compile source file with Ctrl-F7 in VS 2008

    I have added an existing .cpp file to my project.  When I want to compile
    only one file, I usually press Ctrl-F7, but that does not work on this file (it works on some other source files).  When I pull down the Build menu, the Compile option is missing, like it is when a header
    (*.h) file is active.
    When I right-click on the source file in the Solution Explorer, the context menu shows "Compile\tCtrl+F7"; I can compile a single source file that way, but Ctrl-F7 is so much easier and faster.
    I have tried resetting the keyboard shortcut, resetting the profile to the original C/C++ profile, and closing and reopening Visual Studio, but nothing corrected the issue.
    It feels like VS is not recognizing that my source file is a C++ file, despite its name (something.cpp).  Why has this started happening, and how can I get the shortcut (and Build menu) to reset?

    This happens in the following way.  You manually create a new C++ class in an existing project using the editor in VC++.  You then (with the editor still open) add the file to your project.  Visual Studio finds your class info
    and adds it intellisense, making it seem as though VC++ knows your file is in the project.  However, it does not and ctrl f7 will therefore not work.  Removing and adding the file does not help...unless you close the editor window...in which
    case VC++ will correctly add the file if you remove and add it to your project.
    This is not an uncommon way to create a new class - one does not always use the VC++ create class option.  The manual creation method may be preferable if you are not using automated features from VC++ and instead want to copy some code
    from another file, headers for example.   My view is that this is a VC++ bug that should be repaired; apparently VC++ thinks the file is already included if it is open in the editor rather than checking its file list.  But it is easy
    to work around once you know what is happening.

Maybe you are looking for

  • Mail Crashes when I try to open or attach PDFs larger than one page

    Hi All.... Mail (2.1) crashes whenever I try to view or attach a PDF larger than 1 page. Here's a snippet from the latest crash log: Version: 2.1 (752) Build Version: 1 Project Name: MailViewer Source Version: 7520000 PID: 157 Thread: 0 Exception: EX

  • I dropped my iPhone 3G and now it won't past the apple logo screen

    I was listening music this morning and I accidentally dropped my iPhone 3G and hit the floor, it turned off in that moment, and I tried to turn it on and didn't work, when I got home I connected to the computer with the USB cable and the apple logo s

  • In InDesign CS5.5, getting articles panel to show up

    Basic stuff here -- in InDesign CS5.5, when I go to "window" and check "articles," what shows up is "create new review" panel. Is this an older version, fixed in a later patch? Or what!! I'm trying to follow along in the Lynda.com "InDesign5.5 What's

  • Lion Installed: Internal speakers muted and cannot be adjusted thru the audio pane.

    I installed Lion yesterday and spent considerable time looking for an online solution to no avail. The online info suggests to re-install the OS from the disk supplied with the laptop, but would be re-installing Snow Leopard... mmm The quick fix is t

  • InitialContext Bug in WebLogic5.1 ?

    I have a SessionBean Method : public void contextTest() throws RemoteException { try { System.out.println("Principal 1: " + ctx.getCallerPrincipal()); Properties h = new Properties(); h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialCont