java source code file size

H

Hemantha

Hi,

I am trying to define a large array of float type. Unfortunately, the
java source file size comes to around 20MB. Due to this, the compiler
promts an error "java.lang.outofMemory" and does not allow to compile
it. Does anyone know any solution to this problem? There is no problem
in alloacating memory for the array, but it is simply because of the
file size.

Thanks,
Hema
 
V

VisionSet

Hemantha said:
Hi,

I am trying to define a large array of float type. Unfortunately, the
java source file size comes to around 20MB. Due to this, the compiler
promts an error "java.lang.outofMemory" and does not allow to compile
it. Does anyone know any solution to this problem? There is no problem
in alloacating memory for the array, but it is simply because of the
file size.

Put the data in a file and fill each array element line by line?
 
H

Harald Hein

Hemantha said:
I am trying to define a large array of float type. Unfortunately, the
java source file size comes to around 20MB. Due to this, the compiler
promts an error "java.lang.outofMemory" and does not allow to compile
it.

And if it would compile, you will run into the next problem. Java has a
64k class size limit. Read the data from some file.
 
R

Roedy Green

I am trying to define a large array of float type. Unfortunately, the
java source file size comes to around 20MB. Due to this, the compiler
promts an error "java.lang.outofMemory" and does not allow to compile
it. Does anyone know any solution to this problem? There is no problem
in alloacating memory for the array, but it is simply because of the
file size.

What on earth have you done to create a Java program of 20 MB? Surely
99.9% of it must be initialisation of some sort. Instead generate a
data file instead and read the data with a tiny java method.

See http://mindprod.com/fileio.html
 
M

Michael Borgwardt

Harald said:
And if it would compile, you will run into the next problem. Java has a
64k class size limit.

Not true. The 64KB limit is *per method*.
 
P

Phil...

My book says
64K method bytecode limit
64K number of constants in a class
64K number of local variables in a method
64K operand stack limit
64K limit on number of fields
64K limit on number of methods
255 limit on number of diminsions
4GB limit on virtual machine addressing on 32-bit machines
255 limit on number of method arguments (127 if double types)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top