How to compile Java code that uses the Spotfire server API (com.spotfire.server.*)

How to compile Java code that uses the Spotfire server API (com.spotfire.server.*)

book

Article ID: KB0070627

calendar_today

Updated On:

Products Versions
Spotfire Server All

Description

When compiling Java code that uses the Spotfire Server Java API, it must be linked with classes in the package com.spotfire.server.* that is contained within one of the server jar files (which exact jar file depends on the version you are using). Example of extensions that need this jar file for compilation include Custom Authentication Filter, Post Authentication Filter and JAAS module.

Issue/Introduction

When compiling Java code that uses the Spotfire Server Java API, it must be linked with classes in the package com.spotfire.server.* that is contained within one of the server jar files (which one depends on the server version).

Environment

All

Resolution

1. Start by locating one of the following jar files that come with the Spotfire Server installation, located in <Spotfire Server installation directory>/tomcat/webapps/spotfire/WEB-INF/lib/  
  • For TIBCO Spotfire Server 10.3 and higher, use spotfire-public-java-api.jar
  • For TIBCO Spotfire Server 10.2, use public-java-api.jar 
  • For TIBCO Spotfire Server 10.1 and lower, use server.jar.
Copy the jar file to the computer where code will be compiled.

2. The jar file from the previous step (in the example below, using server.jar) should now be added to the class path to javac:

    javac -classpath ".;/path/to/server.jar;" MyCode.java

Example compile command if the compiler runs on the Spotfire server itself:

    javac -classpath ".;C:\tibco\tss\10.1.0\tomcat\webapps\spotfire\WEB-INF\lib" MyCode.java

For examples of some ways this is used to extend Spotfire Server, see "Extending Spotfire Server with Java" in https://community.spotfire.com/articles/spotfire/extending-spotfire or "Spotfire Server API for Custom Authentication" (https://community.spotfire.com/articles/spotfire/tibco-spotfirer-server-api-custom-authentication).

Additional Information