System properties are a way of communicating values from the runtime environment to Java; they are effectively Java's answer to environment variables. JSAMP defines some system properties which you can set to alter the way that it behaves.
If you are starting java from the command line, you can specify
these using java's
-D flag with the syntax
-Dname=value. Note that any such flags must occur
-jar flag on the command line.
For example, to request that JSAMP opens its default HTTP server
to listen on port 2112, you could invoke a JSAMP-using application
java -Djsamp.server.port=2112 -jar foo.jar
They will work the same way for JSAMP's command line tools, and for third-party applications which use the JSAMP library for SAMP communications.
System properties can also be set programmatically from within Java code. Note that in this case you may need to set these property values near the start of the application; in most cases they are only read once.
The following system properties may be used to affect JSAMP's behaviour. Listed alongside the property name is a link to the static public class member which may be used to refer to this property name in code: the javadocs so linked may provide more detail on use.
std: Standard Profile
web: Web Profile
jsamp.hub.profiles=std). This property only affects how a hub is run; it has no effect on SAMP clients.
[hostname]: uses the host's fully qualified domain name
[hostnumber]: uses the host's IP number
internal: normal internal implementation
xml-log: internal implementation which logs all incoming and outgoing XML-RPC messages by writing their full XML form to standard output
rpc-log: internal implementation which logs all incoming and outgoing XML-RPC messages by writing an abbreviated form of their content to standard output
apache: implementation using Apache's XML-RPC library version 1.2; this requires the Apache xmlrpc-1.2b classes to be on the classpath
internalif this property is not specified. The implementations ought to behave the same as far as communications go, though there may be performance differences (the logging ones will be slower for sure). The logging implementations can be useful for debugging.
Note that the system properties
jsamp.profile, which existed in JSAMP 1.0, have been
withdrawn in subsequent versions.
SAMP_HUB environment variable, in accordance
with the standard profile extension, instead.