This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have been trying to write a program to read excel files using java . I am using POI for the same . Earlier i didnt have the jar for this . but now i have downloaded it .
I am confused as to where to place it so that my program can succesfully compile .
I get an error that says the imported package does not exists ..
It doesn't matter where you put those libraries, but you will need to have them in your classpath during compilation and at runtime. Something like "javac -classpath poi-3.2jar MyExcelReadingClass.java"
Joined: Mar 22, 2009
I have tried that using the classpath thing
it doesn't work
can you please help on where the mistake may be ?
Well i tried using eclipse and otherwise also
in eclipse going by the build apth and then adding the external jars isnt solving the problem
is there any other place in the java root directory where i can place the poi package structure for my compiler to find ??
Joined: Oct 08, 2006
You have sent me a copy of this reply as private message. You're pushing me to respond. I don't appreciate this this way of communicating. Use the forum where it is intented for. Public discussion about problems. Also, patience is a virtue. We also have a life.
OK, that was it. Continue with the discussion here
Joined: Mar 22, 2005
Statements like "it doesn't work" and "it doesn't solve the problem" are very unhelpful: TellTheDetails
But what do you mean by "the poi package structure" - you haven't un-jar-ed the jar files, have you? That would be the wrong thing to do.
Joined: Mar 22, 2009
yes when after appending the jar file in the classpath i cidunt solve the problem i unpacked it to see if my required class exists there in a attempt to go through that way .
i am sorry for that approach though .
Even after adding the jar in eclipse as well as claspath i get the same msg " import statements not recognised ... "
Vikash, in English, the pronoun "I" is always capitalized. Also the period (.) at the end of a sentence should not be preceeded by a space. Paying attention to the little illogical details of the language makes you look more professional.
Eclipse can be confusing since Eclipse is a Java program that contains and runs Java programs. However, the Eclipse classpath applies only to the Eclipse program itself, not to the applications that are being maintained in Eclipse.
The classpaths for those applications are contained the the ".classpath" file that is one of 2 files that define an Eclipse Java project - the other file is named ".project". The .classpath file is maintained as follows:
1. In the Navigator view, right-click the icon that defines the root of the project (has the project's name). Select the bottom-most item (Properties). This will display the Project Properties Dialog.
2. On the Project Properties dialog select Java Build Path. This will display a series of tabs.
3. Select the Libraries tab. This is where you define the POI jars to the project. At a minimum, it will have a JRE System Library already defined in it (otherwise even java.lang.Object will be show an error as an undefined type).
Where you keep the libraries is up to you. I often just make a "lib" directory in the project, but for Eclipse, the exact location isn't important except for one thing - if you keep the POI jars within the project, use the "Add JARS" button to define them to the project. Otherwise use the "Add External JARS" button. Make sure that ll the POI jars are displayed in this dialog, then click OK to finalize their definition.
That's all you should need to be able to edit and test your POI app in Eclipse. I'll leave the details of setting up the app to run outside of Eclipse for a later time.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Mar 22, 2009
Thank You so much for the reply.
I will take care of putting my queries in a better way in the future.