Cyc Session Configuration

The primary use of the Session API is to provide the parameters so that the rest of the APIs can access the desired Cyc. If no configuration is provided, applications using the Cyc Java APIs will pop up a window asking the user to specify the host and port where a Cyc server can be found. In contexts where no windowing is available, the program will suffer an unrecoverable error and terminate.

Specifying a Cyc server

A number of mechanisms are available to programatically specify the Cyc server. Here are a few of the simplest. Additional ways to specify the Cyc server will be added as the Session API matures.

Command line

Here are two different approaches:

  1. Specify the server at the command line when you start the program:

    java -Dcyc.session.server=testserver:3600 […path to jar or classpath]

  2. Specify at the command line a java properties file that contains the relevant parameters:

    java […path to jar or classpath]

Inside your properties file, specify the Cyc server with the property cyc.session.server:


NetBeans IDE

First, an important caveat: There are a number of ways to set a Cyc server from within NetBeans, but many of these approaches store your preferences in a file which is likely to get added to source control. If this happens, it can cause subtle and extremely frustrating bugs for other developers, as they blindly run tests from their checkout against the server address you’ve specified. The following approaches avoid that problem.

Setting a global Cyc server address

This will set a set a Cyc server which will be used by all projects in your NetBeans IDE:

  1. Go to Tools -> Options -> Java -> Maven.
  2. In Global Execution Options, type in -Dcyc.session.server=localhost:3600 (substituting your Cyc server’s address).
  3. Click OK.

That’s it! Note that individual projects cannot override this setting. So long as a project is being run in NetBeans, it will use this Cyc server. Of course, you can always edit or remove the value from the Global Execution Options field.

Setting a project-specific Cyc server address

This will set a Cyc server to be used by a single project:

  1. Right click the project in the “Projects” pane.
  2. Select Set Configuration -> Customize…
  3. Click Add.

Then, in the Add configuration dialog:

  • Configuration Id: You can enter anything, but we recommend something reasonably self-identifying, like a username.
  • Keep private to this IDE instance: Make sure this is checked. This is the option which avoids the source control issues described above, so it is critical that you make sure this is checked.
  • Set properties: Set this to your server (e.g., “localhost:3600”) like so: cyc.session.server=localhost:3600
  • Click OK.

Now, with your profile highlighted, click the Activate button. Then click Okay to exit the Project Properties dialog.

That’s it! From now on, your custom configuration should be used by default, and the Cyc Core APIs should automatically use the server you specified. Note that a project-specific address will not override a global address.

To change a project-specific Cyc server address:

  1. Right click the project in the “Projects” pane.
  2. Select Set Configuration -> Customize…
  3. Make sure your custom configuration is selected and click Edit.
  4. Modify the value and click OK.