views:

1166

answers:

5

In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac.

Please keep the answer specific to JBuilder 2005/2006 javac (we cannot migrate away right now, and the Borland Make compiler does not correctly support Java 1.6)

I realize how and what parameters should be passed to javac, the problem is the IDE doesn't seem to allow these to be set anywhere. A lot of configuration is hidden down in the Jbuilder Install\bin*.config files, I feel the answer may be in there somewhere, but have not found it.

A: 

hi there,

Have a look at http://javahowto.blogspot.com/2006/06/fix-javac-java-lang-outofmemoryerror.html

The arguments that you need to pass to JBuilder's javac is "-J-Xms256m -J-Xmx256m". Replace the 256m with whatever is appropriate in your case. Also, remove the quotes.

This should work for java 1.4, java 1.5 and forward.

BR, ~A

anjanb
But the problem is, there doesn't seem to be any way to pass those arguments to javac via the IDE.
Pete
A: 

hi there,

"I realize how and what parameters should be passed to javac, the problem is the IDE doesn't seem to allow these to be set anywhere."

I realized now that you know how to pass the right arguments ONLY not where/how to pass those arguments :-(

How about this : Can you locate where is the JAVA_HOME/bin directory that borland uses ? If yes, then you can rename the javac.exe(to say javacnew.exe) with a javac.bat which in turn will call the javacnew.exe (as well as pass the required arguments) ?

anjanb
A: 

I don't know if this will help since I don't use Borland but in Eclipse, this is a setting that you attach to the program you're going to run. Each program you run in the IDE has configuration specific to it, including arguments to the VM. Is there something like that?

jkrupka
A: 

Do you have a jdk.config file located in JBuilder2005/bin/?

You should be able to modify vm parameters in that file like:

vmparam -Xms256m 
vmparam -Xmx256m

Let me know if this works, I found it on a page talking about editing related settings in JBuilder 2005.

Alex B
That edits settings for the JDK that JBuilder runs under (as it is itself a java application), not the one you have chosen in project settings to be used to compile your project.
Pete
+1  A: 

Hi Pete,

did you find a good solution for that problem?

I have the same problem and the only solution I found is the following: The environment variable JAVA_TOOL_OPTIONS can be used to provide parameters for the JVM.

http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#tooloptions

I have created a batch file "JBuilderw.bat" with the following content:


set JAVA_TOOL_OPTIONS=-Xmx256m

JBuilderw.exe


Each time I start JBuilder using this batch file the env.var. JAVA_TOOL_OPTIONS will be set and javac.exe will receive the setting. The JVM displays at the end the following message: "Picked up JAVA_TOOL_OPTIONS: -Xmx256m"

Drawback: all virtual machines started by JBuilder will get that setting. :(

Thanks, JB

I'll give that a try, thanks for the suggestion
Pete