This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Max size of java class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Max size of java class" Watch "Max size of java class" New topic

Max size of java class

Paul Doherty

Joined: Jan 11, 2001
Posts: 11
What is the maximum size(in kilobytes) a java class can be? Indeed can a class be any size?
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
In theory there is no limit, however a particular machine may throw an OutOfMemoryError if there is not enough memory to completely load the class.
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
Well there are actually practical limits on a variety of entities, like size of identifier names, numbers of methods, limits on parameter lists, etc; So there are upper limits on how big a class file can be.
Details here:
(Thanks to zakaria haque for the link)
[ March 12, 2002: Message edited by: Rob Ross ]

SCJP 1.4
I agree. Here's the link:
subject: Max size of java class
It's not a secret anymore!