Error in creating Excel through Android Application

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() {

        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");

            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);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                } catch (WriteException e) {
                    // TODO Auto-generated catch block

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 to Java Build Path, and to the Order and Export tab. Make sure that the checkbox next to jxl.jar is checked.

Need Your Help

Rounding numbers on AVRs in C

c avr atmega

I am writing code for an AVR (in C) to continuously change the duty cycle of three PWM channels. To do this, I wrote a function that takes in a value as a percentage and sets certain registers to c...