A tip of the hat to mimcc for giving me a lead that lead to a solution.
The link mimcc provided, stated: "The java reporting component is not a part of crystal reports 2008. It's now fully a crystal reports for eclipse product. The JRC is fully supported with CR4E. The current versions will not work with crystal reports 2008 reports."
This was perplexing to me, since I had first tried with Eclipse version 3.5.1 and then subsequently tried the CR4E version and kept getting the same error. I even tried using the Eclipse 3.6 stable build version to no avail.
I then decided to go out and download the crystal reports for eclipse again. I did. The download size was the same. But to my surprise when I extracted the download, I had plugins that I did not have with my previous CR4E.
I then downloaded the "Crystal Reports for Eclipse: Creating a Thick Client Application" .pdf and followed the instructions for loading the external jars. I then ran the following test code, and it worked. I hope this answer will be of use to others in the future since I have seen this question posted a lot of places on the web, but with no answer:
//Crystal Java Reporting Component (JRC) imports.
//import com.crystaldecisions.reports.sdk.*;
import com.crystaldecisions.sdk.occa.report.lib.*;
import com.crystaldecisions.sdk.occa.report.exportoptions.*;
//import com.crystaldecisions.report.web.viewer.*;
//import com.crystaldecisions.reports.reportengineinterface.*;
import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
//import com.crystaldecisions.sdk.occa.report.data.*;
//import com.crystaldecisions.sdk.occa.report.reportsource.*;
//import com.crystaldecisions.reports.sdk.*;
//import com.crystaldecisions.sdk.occa.report.lib.*;
//import com.crystaldecisions.sdk.occa.report.exportoptions.*;
//Java imports.
import java.io.*;
public class JRCExportReport {
//static final String REPORT_NAME = "C:\\JRCExportReport.rpt";
static final String REPORT_NAME = "C:\\Report1.rpt";
static final String EXPORT_FILE = "C:\\myExportedReport.pdf";
public static void main(String[] args) {
try {
System.out.println("Open report");
//Open report.
ReportClientDocument reportClientDoc = new ReportClientDocument();
System.out.println("After declaration");
reportClientDoc.open(REPORT_NAME, 0);
System.out.println("After open");
//NOTE: If parameters or database login credentials are required, they need to be set before.
//calling the export() method of the PrintOutputController.
//Export report and obtain an input stream that can be written to disk.
//See the Java Reporting Component Developer's Guide for more information on the supported export format enumerations
//possible with the JRC.
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
//Release report.
reportClientDoc.close();
//Use the Java I/O libraries to write the exported content to the file system.
byte byteArray[] = new byte[byteArrayInputStream.available()];
//Create a new file that will contain the exported result.
File file = new File(EXPORT_FILE);
FileOutputStream fileOutputStream = new FileOutputStream(file);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());
byteArrayOutputStream.write(byteArray, 0, x);
byteArrayOutputStream.writeTo(fileOutputStream);
//Close streams.
byteArrayInputStream.close();
byteArrayOutputStream.close();
fileOutputStream.close();
System.out.println("Successfully exported report to " + EXPORT_FILE);
}
catch(ReportSDKException ex) {
System.out.println("Inside catch");
ex.printStackTrace();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
}