I am using the jxl package for creating a excel file and export it to SD card through my android application. I have added the jxl.jar to my referenced libraries in my application package in eclipse.
But still when I run the application, it is force closed and I get the below error in logcat
09-10 00:10:31.242: E/dalvikvm(321): Could not find class ‘jxl.WorkbookSettings’, referenced from method h.pkg.main.ExportActivity$2.onClick
Please see below my code for reference..
export.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String Fnamexls="Report-" + tname + ".xls";
String Fnamehtml="Report-" + tname + ".htm";
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard.getAbsolutePath() + "/TripManager");
directory.mkdirs();
if (fityp == 0){
File file = new File(directory, Fnamexls);
WorkbookSettings wbSettings = new WorkbookSettings();
wbSettings.setLocale(new Locale("en", "EN"));
WritableWorkbook workbook;
try {
workbook = Workbook.createWorkbook(file, wbSettings);
workbook.createSheet("Report", 0);
WritableSheet excelSheet = workbook.getSheet(0);
createExcel(excelSheet);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Am getting the class not found error when creating the WorkbookSettings obeject wbSettings in the above code. Please let me know how to resolve this.
Go to the project properties (right click the project ->
Properties, assuming you are in Eclipse), go toJava Build Path, and to theOrder and Exporttab. Make sure that the checkbox next tojxl.jaris checked.