style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-7505528228218001"
data-ad-slot="1225241371">

1.2.3 - The Defaults

Lets take a look at some of the properties that are defined in the build-config.properties and what they control. You can always override any of these properties by either supplying them on the command line with "-D" option, or in a config.properties file placed in the SDK's search path.

Here is a link to the entire builtin-configure.properties file.

Currently properties are only used for configuration, logging and resolvers. Eventually they will control nearly everything in jNetPcap SDK. (Resolvers is a new package that is used to resolve addresses to hostnames or human readable labels.)

User config and default search path

The builtin-config.properties file defines search path that is used to locate the user defined config.properties file. It also defines the name of the file its looking for by default to be "config.properties"

  • config.name - defines the name of the user defined configuration file "config.properties" by default.
  • config.bootstrap.search.path - defines the search path that JConfig class uses to locate the user configuration file.
    • in @{config.file} - this property is not set by default. It allows a user configuration file to be specified by defining this property as absolute path to a property file.
    • in directory defined by System property @{user.dir} which is the current working directory as well.
    • in @{config.dir} that is undefined by default, but can be set to user specific configuration directory containing this an possible many other config files.
    • @{home.dir} - this is jNetPcap home directory. By default this is a ".jnp" subdirectory in user's normal home directory.
    • In classpath under resources directory and under ./ classpath directory.

The config.bootstrap.search.path looks in lots of different places for user configuration file. It search each of those areas for a file named config.properties. If that file is found, it is merged with the builtin-config.properties, allowing user properties override the builtin values.

jNetPcap home directory

jNetPcap needs a place to store files such as cache files and possibly user configurations. All the search paths default to looking in various places and especially the the @{home.dir} property. This property is a compound property:

subdir = .jnp
home.dir = @{user.home}/@{subdir}

Where @{user.home} property is a java system property that points at user's home directory and @{subdir} is defined to be ".jnp". This directory won't exist by default and either the user can create it or you can allow the SDK to do it for you when its needed the first time. The property @{home.mkdir} control this permission:

home.dir = false

The default is false, which denies SDK from creating this directory. If you change this property to true, the directory will be created automatically, but only when its actually needed.

To change the name of the jNetPcap sub directory, simply define a different value for @{subdir} property.

subdir = jnetpcap