• Post Reply Bookmark Topic Watch Topic
  • New Topic

unable to comple my java file  RSS feed

 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i am doing here is i am just compiling a java file by taking a big identifier( 1000's of characters) and compiling it.
it gives this compile time exception

The system is out of resources.
Consult the following stack trace for details.



java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapCharBuffer.<init>(HeapCharBuffer.java:39)
at java.nio.CharBuffer.allocate(CharBuffer.java:312)
at com.sun.tools.javac.util.DefaultFileManager.decode(DefaultFileManager.java:582)
at com.sun.tools.javac.util.DefaultFileManager.access$300(DefaultFileManager.java:54)
at com.sun.tools.javac.util.DefaultFileManager$RegularFileObject.getCharContent(DefaultFileManager.java:744)
at com.sun.tools.javac.util.DefaultFileManager$RegularFileObject.getCharContent(DefaultFileManager.java:637)
at com.sun.tools.javac.main.JavaCompiler.readSource(JavaCompiler.java:416)
at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:480)
at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:697)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:629)
at com.sun.tools.javac.main.Main.compile(Main.java:761)
at com.sun.tools.javac.main.Main.compile(Main.java:686)
at com.sun.tools.javac.main.Main.compile(Main.java:675)
at com.sun.tools.javac.Main.compile(Main.java:70)
at com.sun.tools.javac.Main.main(Main.java:55)
I think java is not supporting unlimited variable length
so itz a perfect bug in the software.. i think java sould limit or ristrict the length of java identifiers :roll:
ho poor javasoft
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
( 1000's of characters)

How much exactly ? I've tried with 220,000 and it worked.
(I don't know why I actually tried this stupid thing)

By the way, from the Java Spec:
6.8.7 Local Variable and Parameter Names
Local variable and parameter names should be short, yet meaningful. They are often short sequences of lowercase letters that are not words.

ho poor javasoft

Feel free to use other languages supporting such variable names
[ July 03, 2006: Message edited by: Satou kurinosuke ]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear saikrishna ,


Just try to increase Heap size for ur application. Check it out java -options for increasing Heapsize..


Nirumagic
 
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"nirumagic",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've tried it with commenting the big line but no chance of compiling it gives the same exception
actually i don't need to keep such a big identifier but checking whether java supports to compile unlimited length of identifier according to the specification :roll:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!