WebObjects 4: Setting Java VM Command-Line Arguments

This document discusses methods for configuring the Java Virtual Machine under WebObjects 4. For information on using Java under WebObjects 3.5.1, please see article 70035, WebObjects 3.5.1 Java Bridge Troubleshooting Guide.
Setting Java VM Command-Line Options


Q: How do I pass command-line arguments to the Java VM? I need to increase the garbage heap size, so that my application doesn't run out memory.

A: WebObjects 4 introduces a new way to specify arguments to the Java VM. The following arguments may be specified. Those ending in "Size" or "Port" take number arguments; all others take YES or NO.


There are three ways to set these arguments:

1) Use the defaults command-line tool:
defaults write myapp NSJavaMinHeapSize 33554432
2) Pass them on the command line:
MyApp.woa/MyApp -NSJavaMinHeapSize 33554432
3) Set them programatically. Refer to the documentation for NSUserDefaults (Objective C) or com.apple.yellow.foundation.NSUserDefaults (Java).


Q: After porting a WebObjects 3.5.1 application to WebObjects 4, I receive this message. What should I do?

Mar 22 08:23:54 VM[268] NSJavaVirtualMachine: WOF 3.5.1 compatibility method  
+setDefaultVirtualMachineArguments: has been called.  This call is no longer  
necessary, and will not be supported in the future.  Get your code off it  
now!


The setDefaultVirtualMachineArguments: method was introduced in the WebObjects 3.5.1 Java Patch (see article 70037, WebObjects Current Patch List for current WebObjects patch information.) It should only be called on patched WebObject 3.5.1 systems. After porting to WebObjects 4, this call should be replaced by the technique described above.
Published Date: Feb 19, 2012