We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › length limit of a code
Page Index Toggle Pages: 1
length limit of a code (Read 1048 times)
length limit of a code
Mar 22nd, 2010, 11:18am
 
I am new to processing. Generated a code (by a C code) of 40K lines, basically lots of polygons like:

beginShape();
vertex(1424.297852, 1448.632324);
vertex(1418.017334, 1450.309937);
....
endShape();

when trying to run I get:

"The code of method setup() is exceeding the 65535 bytes limit."

Googling seem to suggest this is some kind of java limit. But how can I avoid hitting it if I need to drawing lots of polygons? Thanks.
Re: length limit of a code
Reply #1 - Mar 22nd, 2010, 12:19pm
 
Put your polygon coordinates in a file; read the file contents at runtime and go from there.
Re: length limit of a code
Reply #2 - Mar 22nd, 2010, 1:47pm
 
Yes that should work, however when I export as applet, it does not work. Should an applet be able to read a file?
Re: length limit of a code
Reply #3 - Mar 22nd, 2010, 4:39pm
 
I searched a bit about that too. Strange I never heard of it. However, I found out that this limitation is per Java class. So, IMO, a crude approach would be to just separate your data to different classes. Ugly, but it may work.

Good luck.

EDIT: Or of course, as subpixel mentioned, use a file and place it somewhere on the web, then read from it. I suppose this can be done.
Re: length limit of a code
Reply #4 - Mar 22nd, 2010, 5:56pm
 
dont place it somewhere, place it on the same server if possible and you dont have to sign your applet...
Re: length limit of a code
Reply #5 - Mar 22nd, 2010, 11:33pm
 
If you create a "data" folder in your sketch folder, the contents of that folder will be included in the JAR file produced for the applet. Processing's file access methods know how to find these files.

-spxl
Re: length limit of a code
Reply #6 - Mar 23rd, 2010, 8:09am
 
Creating a "data" folder and placing the file in there works, thanks!
Page Index Toggle Pages: 1