This week's book giveaway is in the Design and Architecture forum. We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line! See this thread for details.
I have a .java file whose size is more than 1 GB. Please dont curse me for this as this file is automatically generated by the existing system based on some inputs.
As of now this 1 GB java file is giving errors while compiling. It is not able to compile.
I want to ask does java has such restrictions. Is there a way to compile such file. Other way around is change the code which generates 1GB file.
If you guys have anything related to this please let me know.
Offhand I don't remember what if any intrinsic limits there may be in the process. But I'm not surprised that a 1 GB file causes problems. Perhaps you could tell us what is the text of the first few compile errors you get? That may well give important clues as to what, exactly, the problem is.
You can have problems with the JVM that runs javac running out of heap. You can fix these by passing arguments to that JVM using the -J option of javac.
For example, -J-Xms48m sets the initial heap to 48 megabytes.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
The compiler will not accept any sourcefile that has more than 64K lines in any single method. I'm pretty certain there are similar restrictions to the number of methods per class, data members per class, and classes per file.
Any class that big is a monster that needs serious refactoring anyway Or if it's generated, kill the generator.
I'm with you Bill, I'd love to know how you end up with a 1 GB source file. I can't think of a project that I've worked on that had anywhere near 1 GB of source total.
Just for reference I downloaded "Moby Dick" by Herman Melville from Project Gutenberg, unzipped it is 1.15 MB.
Hi all, I faced a similar problem in my project. We use one propertory IDE for development which generates the java code. I found two generated files of size 5 MB. And these files failed to compile because of the large size of methods. Then I manually edited the file and replaced the large methods with a set of small methods and written some logic to integrate these small methods. So that from out side it appeared the same but internally it calls these small methods.
Thanks,<br />Murali...
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?