Compiling the Cognos 8 SDK Java Samples on Windows

May 15, 2008 · Filed Under Code Samples, Cognos 8 SDK 

When the Cognos 8 SDK is installed, the java libraries (jar files) are installed in the ..\c8\sdk\java\lib folder. The sample applications are located in individual directories in the ..\c8\sdk\java folder. Also included are two scripts, build-samples.bat (for Windows) and build-samples.sh (for Unix and Linux) for compiling the java samples. Here are the steps for compiling the samples:

1. Verify that you have a JDK installed. Cognos 8 requires JDK 1.4 or higher. The JDK can be downloaded from Sun Microsystems here.

2. Check that the JDK location is in the Windows PATH environment variable. To do this, type ’set path’ from the command prompt.

3. Open up the file CRNConnect.java in the ..c8sdkjavacommon folder. Edit the following line (line 102), if necessary, to reflect the location and port number of your Cognos 8 server:

public static String CM_URL = “http://localhost:9300/p2pd/servlet/dispatch”;

4. In the build-samples. bat file, modify the following line to reflect where the JDK is installed:

set JAVA_HOME=c:/jdk1.4.2_15 

5. If necessary, modify this line to point to where Cognos 8 is installed:

6. Run build-samples.bat to compile the samples. This script will compile the sample code and create .class files in the folders. In each of the folders there will be a run.bat file.

7. To test your compiled sample code, execute the run.bat file in the CapabilitiesGUI directory to run the sample Capabilities application.

8. If the URL is correct, click the OK button to connect to Cognos 8.

Troubleshooting

Upon running the sample code, the following error will occur if the java compiler compatibility flag needed to be set:

Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file.

The samples will use the JRE that ships with Cognos 8. The error occurs because the java complier defaults to a version that is not compatible. To set the compatibility, in the build-samples.bat file, add the following two switches after “%JAVAC%”: -source 1.4 -target 1.4

The line will read as follows:

“%JAVAC%” -source 1.4 -target 1.4 -classpath “%CLASSPATH%” Alerts/*.java CancelExec/*.java Common/*.java CapabilitiesGUI/*.java ContentStoreExplorer/*.java CreateDrillThrough/*.java DeployPackage/*.java DispatcherControl/*.java ReportCopyMove/*.java EventTrigger/*.java ExecReports/*.java ExecReportsAt/*.java GroupsAndRolesGUI/*.java HandlersCS/*.java PermissionsGUI/*.java PrintReport/*.java QueryCM/*.java RenderReport/*.java ReportAdd/*.java ReportCreate/*.java ReportDelete/*.java ReportParams/*.java ReportSpec/*.java ReportUpgrade/*.java runreport/*.java SaveAs/*.java Scheduler/*.java Security/*.java SendEmail/*.java Submit/*.java TesterCM/*.java ViewAll/*.java ViewCMReports/*.java ViewCMPackages/*.java

Execute build-samples.bat again to recreate the class files.

Links to social bookmarking sites.
  • Digg
  • StumbleUpon
  • Technorati
  • del.icio.us
  • Reddit
  • TwitThis
  • Live

Comments

4 Responses to “Compiling the Cognos 8 SDK Java Samples on Windows”

  1. Shishir on September 19th, 2008 1:18 pm

    Hi,

    This SDK introduction is really useful.I am also trying to use SDK to automate the deployment procedure.I am tweaking the Deploy Package folder under java samples in Cognos SDK.I am getting the following error when i am clicking on the import option when i run DeploymentUI.java :
    An error occurred in getting Deployment options.he error: CM-REQ-4342 An error occurred with the client.

    Can you please suggest what can be the reason for the same?

    Thanks.

  2. Latha on October 15th, 2008 6:17 am

    Check whether you are providing correct data for user details like username, password and namespace ID … CM-REQ-4342 is due to the error in those details..

  3. Naresh on October 21st, 2008 4:33 am

    hi,

    Can anyone help me how to deploy sdk samples of Cognos?
    i tried the above explanationbut failed to achieve it…

    regds,
    naresh

  4. tess cassell on November 5th, 2008 7:14 pm

    Does anyone know of someone having worked extensively on cognos sdk? I am having a lot of trouble finding a good COGNOS sdk developer, if you know of someone pls. email ne at tess@bi-usa.biz

Leave a Reply