#
`java.rmi` Properties

Please Note: Unless otherwise stated, any output from these properties is sent to `System.err`.

## Properties that are useful to set on JVMs* that export remote objects

> `java.rmi.activation.port` (1.2 and later)
>   This property is used to set the TCP port number on which this VM should communicate with `rmid` (by default, `rmid` listens on port 1098, but can be set to listen on a different port by using the `-port` option on the `rmid` command line). The default value of this property is 1098, so this property only needs to be set on VMs that need to communicate with an instance of `rmid` that is running on a port other than 1098.

> `java.rmi.dgc.leaseValue` (1.1 and later)
>   The value of this property represents the lease duration (in milliseconds) granted to other JVMs that hold remote references to objects which have been exported by this JVM. Clients usually renew a lease when it is 50% expired, so a very short value will increase network traffic and risk late renewals in exchange for reduced latency in calls to `Unreferenced.unreferenced`. The default value of this property is 600000 milliseconds (10 minutes).

> `java.rmi.server.codebase` (1.1 and later)
>   This property specifies the locations from which classes that are published by this JVM (for example: stub classes, custom classes that implement the declared return type of a remote method call, or interfaces used by a proxy or stub class) may be downloaded. The value of this property is a string in URL format (or a space-separated list of URLs in 1.2 and later) that will be the codebase annotation for all classes loaded from the CLASSPATH of (and subsequently marshalled by) this JVM.

> Note:This property must be set correctly in order to dynamically download classes and interfaces using RMI. If this property is not set correctly, you will likely encounter exceptions when attempting to run your server or client. For more information on this property, see Dynamic code downloading using RMI (Using the `java.rmi.server.codebase` Property).

> `java.rmi.server.hostname` (1.1 and later)
>   The value of this property represents the host name string that should be associated with remote stubs for locally created remote objects, in order to allow clients to invoke methods on the remote object. In 1.1.7 and later, the default value of this property is the IP address of the local host, in "dotted-quad" format.

> `java.rmi.server.logCalls` (1.1 and later)
>   If this value is `true`, incoming calls and exceptions thrown from incoming calls will be logged to `System.err`. Setting this property to `true` will greatly assist you in debugging your RMI programs. See also `sun.rmi.server.exceptionTrace`.

> `java.rmi.server.randomIDs` (1.1.8 and later)
>   If this value is `true`, object identifiers for remote objects exported by this JVM will be generated by using a cryptographically secure random number generator. The default value is `false`.

> `java.rmi.server.useCodebaseOnly` (1.1 and later)
>   If this value is `true`, automatic loading of classes is prohibited except from the local CLASSPATH and from the `java.rmi.server.codebase` property set on this JVM. Use of this property prevents client JVMs from dynamically downloading bytecodes from other codebases. This property is ignored in the implementations of 1.2 and 1.2.1 because of a bug.

> `java.rmi.server.useLocalHostname` (1.1.7 and later)
>   RMI now uses an IP address to identify the local host when the `java.rmi.server.hostname` property is not specified and a fully qualified domain name for the localhost cannot be obtained. In order to force RMI to use the fully qualified domain name by default, you need to set the this property to `true`.

## Properties that are useful to set on JVMs that make remote method calls

> `java.rmi.server.codebase` (1.1 and later)
>   This property specifies the locations from which classes that are published by this JVM (for example, custom classes that implement an interface that is the declared parameter type of a remote method call) may be downloaded. The value of this property is a string in URL format (or a space-separated list of URLs in 1.2 and later) that will be the codebase annotation for all classes loaded from the CLASSPATH of (and subsequently marshalled by) this JVM.

> Note: Classes that exist in both the server's codebase and the client's CLASSPATH will be loaded from the client's CLASSPATH, rather than from the server's codebase as intended. For more information on this property, see Dynamic code downloading using RMI (Using the `java.rmi.server.codebase` Property).

> `java.rmi.server.disableHttp` (1.1 and later)
>   If this value is `true`, HTTP tunneling is disabled, even when `http.proxyHost` is set. The default value is `false`. If you know that your program will never need to use HTTP tunneling, then by disabling HTTP tunneling, you should see shorter timeouts for failed connections.

> `java.rmi.server.useCodebaseOnly` (1.1 and later)
>   If this value is `true`, automatic loading of classes is prohibited except from the local CLASSPATH and from the `java.rmi.server.codebase` property set on this JVM. Use of this property prevents client JVMs from dynamically downloading bytecodes from other codebases. This property is ignored in the implementations of 1.2 and 1.2.1 because of a bug.

We are very interested in knowing whether this information is useful. Please send any comments or suggestions to: `rmi-comments@java.sun.com`, with a subject of "java.rmi properties FAQ".

*As used on this web site, the terms "Java(TM) virtual machine" or "JVM" mean a virtual machine for the Java platform.

Copyright © 2003 Sun Microsystems, Inc. All Rights Reserved. Please send comments to: `rmi-comments@java.sun.com` |