Return-Path: Delivered-To: apmail-jakarta-poi-user-archive@www.apache.org Received: (qmail 38711 invoked from network); 10 Jun 2005 17:03:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Jun 2005 17:03:34 -0000 Received: (qmail 64718 invoked by uid 500); 10 Jun 2005 17:03:29 -0000 Delivered-To: apmail-jakarta-poi-user-archive@jakarta.apache.org Received: (qmail 64704 invoked by uid 500); 10 Jun 2005 17:03:29 -0000 Mailing-List: contact poi-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "POI Users List" Reply-To: "POI Users List" Delivered-To: mailing list poi-user@jakarta.apache.org Received: (qmail 64678 invoked by uid 99); 10 Jun 2005 17:03:29 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of tcat.seq@gmail.com designates 64.233.184.199 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.199) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 10 Jun 2005 10:03:25 -0700 Received: by wproxy.gmail.com with SMTP id 58so610695wri for ; Fri, 10 Jun 2005 10:03:04 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=j+z4JIJ52rN3Cj50mQBeGvYlXN/3/w0RilxKnCJKW7Y3Mrw6elovRvd4wm1yHimEKFca2riF81wsL34Lrz1wOf/qsfjLGMwHCkm+OnAVeTImm1ieWWbUu81CSO7LEDuKjYxmetMpVndNUJHeMELqg1lOFenKsb6DH4pgJbbn1f4= Received: by 10.54.25.52 with SMTP id 52mr1177230wry; Fri, 10 Jun 2005 10:03:04 -0700 (PDT) Received: by 10.54.14.4 with HTTP; Fri, 10 Jun 2005 10:03:04 -0700 (PDT) Message-ID: Date: Fri, 10 Jun 2005 12:03:04 -0500 From: R S Reply-To: R S To: POI Users List Subject: Re: HSSF class not found errors In-Reply-To: <42A9B3C8.707@webdesignteks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <42A98B8A.5030704@webdesignteks.com> <42A9B3C8.707@webdesignteks.com> X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Check your classpath. You java program is unable to find the hssf classes. If you are sure that the poiXXX.jar is in the classpath and it still throws the same errors, look at the contents of the poiXXX.jar. Make sure the files mentioned in the error are present. RS On 6/10/05, James Chaney wrote: > Neither - but if I take the "package" off then I get even more errors. > All I want to do is to juts be able to create an Excel spreadsheet > through a servlet - I have been able to do it with a JSP page but need > to be able to connect to an Oracle database and pull records from there > and them insert them into the XLS file. I have the db connection part > working fine and I have iText working fine to create the PDF part of the > application but for some reason I can not get HSSF to cooperate :( >=20 > R S wrote: >=20 > >Are you sure you want to package your java file (WriteExcel) in the > >"org.apache.poi.hssf.usermodel" package? Is your code in the > >"org/apache/poi/hssf/usermodel" directory? > > > >I hate to come off as a jerk, but it would be in your best interests > >to review java packaging. > > > >RS > > > > > > > >On 6/10/05, James Chaney wrote: > > > > > >>Question on setting up POI to use HSSF - I have downloaded > >>poi-2.5.1-final-20040804 and added it to my ClassPath variable. I then > >>create a java file with the following: > >> > >>package org.apache.poi.hssf.usermodel; > >>import org.apache.poi.hssf.usermodel.HSSFWorkbook; > >>.......... > >> > >>And when I try to compile it I get the following errors: > >> cannot resolve symbol > >> class HSSFWorbook > >> package usermodel > >> import org.apache.poi.poifs.filesystem.HSSFWorbook; (I get the same > >>error for all the imports org.apache.poi.hssf.usermodel.* - just listed > >>the one) > >> > >>If I remove the package and import statements the rest of my java code > >>compiiles just fine. Can you please tell me what I may be doing wrong? = I > >>have explained the top part in short in recommendation from the jakarta > >>site - here is my actual code: > >> > >>package org.apache.poi.hssf.usermodel; > >> > >>import java.io.FileInputStream; > >>import java.io.FileOutputStream; > >> > >>import org.apache.poi.hssf.usermodel.HSSFCell; > >>import org.apache.poi.hssf.usermodel.HSSFRow; > >>import org.apache.poi.hssf.usermodel.HSSFSheet; > >>import org.apache.poi.hssf.usermodel.HSSFWorkbook; > >>import org.apache.poi.poifs.filesystem.POIFSFileSystem; > >> > >>public class WriteExcel > >>{ > >> private static String filename =3D "C:\\temp\\sales.xls"; > >> public static void main(String[] args) > >> { > >> try > >> { > >> System.out.println( > >> "Demonstration of programmatic manipulation of " + > >> "Microsoft Excel Spreadsheet via the Apache POI API."); > >> // open the Excel Spreadsheet > >> POIFSFileSystem fs =3D > >> new POIFSFileSystem(new FileInputStream(filename)); > >> HSSFWorkbook hssfworkbook =3D new HSSFWorkbook(fs); > >> // grab the first sheet > >> HSSFSheet sheet =3D hssfworkbook.getSheetAt(0); > >> // grab the appropriate cell we want to manipulate > >> // cell B2 maps to Row 1, Column 1 > >> HSSFRow row =3D sheet.getRow(1); > >> HSSFCell cell =3D row.getCell((short)1); > >> // if the cell we want is not created, create > >>it if (cell =3D=3D null) > >> cell =3D row.createCell((short)1); > >> // set the cell type. In this case, our cell is numeric > >> cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); > >> // set the cell's value > >> cell.setCellValue(89000.00); > >> // Write the output to a file > >> FileOutputStream fileOut =3D new FileOutputStream(filename); > >> hssfworkbook.write(fileOut); > >> // Close the file > >> fileOut.close(); > >> } > >> catch(Exception e) > >> { e.printStackTrace(); > >> } > >> } > >>} > >> > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org > >>Mailing List: http://jakarta.apache.org/site/mail2.html#poi > >>The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > >> > >> > >> > >> > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org > >Mailing List: http://jakarta.apache.org/site/mail2.html#poi > >The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > > > > > > > > > > > > >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ >=20 > --------------------------------------------------------------------- To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/