tags:

views:

185

answers:

1

I know how to use -Xmx -Xms at runtime, is there a way to ask the compiler to allocate more ram. I have 2 gigs on my pc. I don't use an IDE just textpad. I am trying to create a BigInteger with 10,000,000 digits and do operations on it. I tried creating a StringBuffer and ensureCapacity(10000000) and it wont compile. Is there a class I can use to tell the compiler I need more ram before it compiles, or while it compiles? I did read about RunTime methods and am going to keep multiplying a BigInteger and watch the Heap. I tried embedding the string into the code "1000000" + etc 10,000,000 digits it wont compile that either.

+4  A: 

The runtime memory options for javac are not specified using a plain -X flag. Instead use the -J flag as shown in the following example where the startup memory is reserved to 128M.

$javac -J-Xmx128M FooBar.java

The option although being a non-standard option is available on both Solaris and Linux, and Windows. Unsure about the Mac.

Vineet Reynolds