Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a limit on the number of lines of code you can put in an Eclipse java doument

I have a project I have been working on and all was going well until today. I have close to 6000 lines of code in one java class document. If I try to put one more IF clause into the code, the program throws an exception when the class is called on. All additional snippets that I have tried to place into the class, cause the class to fail when called on. I have tried to add test code that I know works fine, and they all throw the force close alert dialog. Trust me there is nothing wrong with the last snippet that I attempt to place into the class. Once I take out the last "if" snippet, there are no errors. Has anyone ever seen this before? The exception is thrown in the emulator, when the class is called. I get the force close alert window. Here is the java file size: 172,503 bytes Thanks in advance!

like image 388
lastshadowrider Avatar asked Apr 21 '12 04:04

lastshadowrider


3 Answers

you can modify the same using following settings:

--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
like image 188
Satya Avatar answered Sep 19 '22 18:09

Satya


I ran into that problem some time ago and found out that its no problem to have 50k lines and more of code in one class as long as the method limit is not exceeded.

Depending on what's in one single method that actually causes the bytecode size I experienced limitations between 2-3k lines of code/method.

added:

by the way at a certain point in fact Eclipse crashes when your total code becomes too large to compile - just increase Eclipse's memory to 1 Gb or so. SO far that was enough for my projects having around 100k lines in total...

like image 28
user387184 Avatar answered Sep 19 '22 18:09

user387184


I've noticed this before, Eclipse runs off of Java itself, so it is very RAM intensive, if you have too much code so that it needs more than can be alloted it will crash.

like image 23
Jeremy Sayers Avatar answered Sep 19 '22 18:09

Jeremy Sayers