TITLE
    WebObjects 4: Setting Java VM Command-Line Arguments
Article ID:
Created:
Modified:
70050
3/30/99
3/2/00

TOPIC
DISCUSSION

    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.

    • NSJavaCheckSource (equivalent to -cs or -checksource)
    • NSJavaNativeStackSize (equivalent to -ss<number>)
    • NSJavaStackSize (equivalent to -oss<number>)
    • NSJavaMinHeapSize (equivalent to -ms<number>)
    • NSJavaMaxHeapSize (equivalent to -mx<number>)
    • NSJavaVerifyMode (equivalent to -verify)
    • NSJavaEnableClassGC (NO is equivalent to -noclassgc)
    • NSJavaEnableVerboseGC (equivalent to -verbosegc)
    • NSJavaDisableAsyncGC (equivalent to -noasyncgc)
    • NSJavaVerbose (equivalent to -v or -verbose)
    • NSJavaDebugging (equivalent to -debug)
    • NSJavaDebugPort

    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 -NS JavaMinHeapSize 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 compatability 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 setDefaultVirtualMachineArgume nts : method was introduced in the WebObjects 3.5.1 Java Patch (see the 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.


Document Information
Product Area: WebObjects
Category: WebObjects 4
Sub Category: Deployment

Copyright © 2000 Apple Computer, Inc. All rights reserved.