Using External JAR file within Web Dynpro DC

Hi,
I have created a Web Dynpro DC and I need to use an external JAR file.
I want to use this external JAR file within the same Web Dynpro DC and NOT creating another DC to house the external JAR file as I can see from the blog.
I have included the external JAR file in the "lib" folder of the Web Dynpro DC.
When I tried to perform a DC build, it keeps complaining error....
How should I solve this problem...
Thanks.
mike

Hi Mike,
Go through the below which might help you.
Re: Lookup of RFC Destinations
Re: Import a Java Bean from a different DC
Web Dynpro References
Re: j2ee library with webdynpro
Re: Web Services :HTTP Destination not getting resloved.
http://help.sap.com/saphelp_nw70/helpdata/en/46/3ce3e4df201d63e10000000a11466f/frameset.htm
Thanks n Regards,
Jhansi Miryala

Similar Messages

  • Using External JARs in a Web Dynpro Project

    Hi,
    I'm having some difficulties building and deploying a Web Dynpro application that uses the Apache JaxMe libraries.  We're using SP11 of Developer Studio and WebAS and we're using JDI Scenario 2+ for building and deployment.  Thus far here's the procedure I followed:
    1) Created a DC of type "External Library"
    2) Added the necessary jars to the "libraries" folder of the External Library DC project (the jars that I added were jaxme2-rt.jar, jaxme2.jar, jaxmeapi.jar, jaxmejs.jar, jaxmepm.jar, jaxmexs.jar, xercesImpl.jar, xml-apis.jar all of which were pulled from the Apache JaxMe implementation download)
    3) For each of the jars in the libraries folder I right-clicked, selected Develoment Component then clicked "Add to public part" 
    Then after reading this note:
    https://websmp206.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=012006153200000038152005
    I created a J2EE Library Component DC following these steps:
    1) Created a new DC of type J2EE Server Component / Library
    2) Added the External Library DC that I had just created as a "Used DC"
    3) Edited the DC so that it is used a Build Time and Run Time
    Finally I went to the Web Dynpro application and included the J2EE Library Component DC as a Used DC at build time and run time. 
    I was able to build all of the project successfully (doing a DC build for each) then I was able to succesfully deploy the applications to my local development WebAs (by doing a DC deploy for both the J2EE Server Component and the Web Dynpro application)  The problem is that at runtime the Web Dynpro application cannot find the external libraries.  For example, I receive the following error when running the application:
    java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    The "missing" class is included in one of the jars but for some reason these jars are not accessible to Web Dynpro at runtime. 
    Any help you can provide on this problem is very much appreciated.
    Thanks in advance!
    Jason

    I created the <b>JAR</b> with the following class (structure):
       <b>com.sap.tc.webdynpro.tests.utils.TableSorter.class</b>
    I have followed the steps that was suggested in the forum:
    ==========================================================
    1) creating an Extneral library DC
    2) import the JAR "com.sap.tc.webdynpro.tests.util.jar" to the libraries folder of the External Library DC project
    3) Right-click on the JAR imported to the project and add them to the public part.
    This DC is now ready to be used as a build-time reference that will allow CBS to build the "main" Web Dynpro application that will use the external libraries. Next, we have to create a new Web Dynpro DC to hold the class files here are the steps:
    1) Create a new Web Dynpro DC
    2) Create a new public part, selecting the "Can be packaged into other build results" option
    3) Rename the JARs as Zip files and extrct the full content (folders and class files) to your root folder
    4) Import the folders and files to the src/packages folder
    5) Expand the public part node that was created and select the "Entities" node, right-click it and choose Edit
    6) In the Entity Type list select the "Folder" option then in the selected entities tree pick each of the folders that you imported in step 5 (above)
    7) Now do a DC build and a DC deploy of the project
    Then check-in, activate, and release any activities you have associated with creating these two projects. In the DC perspective, refresh the Active DCs and Inactive DCs to ensure that both new DCs appear in the Active list. Now we have to setup the references to these DCs in our main Web Dynpro application. To do this, follow these steps:
    1) Open the Web Dynpro perspective and right click the Used DCs node then choose "Add Used DC.."
    2) Pick the public part of the External Library DC that we created (first) and set it to have a Build Time dependency
    3) Again, right click the Used DCs node and choose "Add Used DC.." then choose the public part of the Web Dynpro DC that we created and give it a Run Time dependecy (weak) and click finish.
    4) Now, due to what I think is a bug. You must right click on the Web Dynpro "used DC" that you just added in the previous step, and set the run time dependency again (it seems to revert to the default values for some reason)
    5) Now do a DC build and a DC deploy on the "main" web dynpro application.
    6) Check-in, activate, and release any activities associated with adding these references and then others on your team may use the classes in the external libraries within the Web Dynpro project.
    However, when I executed, the following exception occurred:
    ===========================================================
    Error stacktrace:
    java.lang.<b>NoClassDefFoundError</b>: <i>com/sap/tc/webdynpro/tests/utils/TableSorter</i>
         at br.com.embraer.materiais.zdplmm001.view.Zdplmm001_0500View.wdDoModifyView(Zdplmm001_0500View.java:138)
    <b>What's missing????</b>
    Thanks
    Robson Lima
    Sao Paulo - Brazil

  • Using External Library in Mobile Web Dynpro Offline

    Hi all,
    i would like to use a jar in a Mobile Application for Handheld and i followed the steps from the wiki "Using External Library in Mobile Web Dynpro Offline" at
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/usingExternalLibraryinMobileWebDynpro+Offline
    >How to use External Library in Mobile Web Dynpro Offline
    >For using external jar in local deployment scenario, one can do following:
    >1. In the dc where jar has to be used, add the jar as external jar classpath entry. It can be done via <dc> > (Right-click)> properties->Java Build Path->Select "add external jar".
    >2. Do the programming using the jar.
    >3. Shut down the mobile client.
    >4. Copy the jar in the "lib" folder of mobile client installation.
    >5. Deploy the application in the IDE.
    >6. Run the application.
    >In 5, the jar will not deployed and will be picked from the lib folder during 6.
    >...
    >Note: This will work on and after SAP Net Weaver CE 7.1 SR3 with Mobile plugins from CE 7.1 SR3 (and after).
    i get a error at the deployment with the message "...package myres does not exist...":
        >echo:     C:Documents and SettingsTPCompworkspace.jdiLocalDevelopment     4CDFCC9F800D44D0F2B7FEDE7245CFB5gen_oca
          >echo:   class path:  C:Program FilesSAPIDECEeclipsepluginscom.sap.tc.ap_2.0.1.080222142948compXOCADCssap.com     cmobileocaapi\_compgendefaultpublicapilibjavasap.comtcmobileocaapi~api.jar
          >echo:   output dir:  C:Documents and SettingsTPCompworkspace.jdiLocalDevelopment     4CDFCC9F800D44D0F2B7FEDE7245CFB5classes
         >javac: Compiling 16 source files to C:Documents and SettingsTPCompworkspace.jdiLocalDevelopment     4CDFCC9F800D44D0F2B7FEDE7245CFB5classes
         >javac: ERROR: C:Documents and SettingsTPCompworkspace.jdiLocalDevelopment     4CDFCC9F800D44D0F2B7FEDE7245CFB5gen_ocacomsapdemoemployee_scserviceimplEmployeeService.java:8: package myres does not exist
         >javac: ERROR: import myres.TestA;
    there is only sap.comtcmobileocaapi~api.jar in the class path and myres.jar was not added.
    how can i fix my problem or does the steps in the wiki not work yet for SAP Net Weaver CE 7.1 SR3 with Mobile plugins from CE 7.1 SR3 ?
    Thanks,
    Ismet

    Hi,
    1) in Development Infrastructure Perspective -> rightklick in Navigator/Projekt Explorer  -> new Project  -> (Development Infrastructure)  Development Component (DC).
    NWDS generates Project Ressources e.g. the folder "libraries"
    2) copy the jars to the "libraries" folder.
    3) rightklick on the newly created Development Component (DC) ->  Development Component -> Show In ->  Development Properties -> go to the Tab "Public Parts",
    in -> "Defined Public Parts" -> klick on Button "Add" -> give a name for "Public Part" -> at "Purpose" select "Compilation" -> Finish.
    rightklick on the newly created Public Parts -> select  "Manage Entities" and select the jars you want to use -> Next -> Finish.
    4) switch to the Mobile Apps for Handhelds Perspective ->  in Development Component  select e.g. the Service Component or the UI Component ->
    rightklick ->  Development Component -> Show In ->  Development Properties -> got to Tab "Dependencies" -> klick on Button "Add"  -> under the Node MyComponents -> select the newly created Development Component with the Public Parts/jars (that was created in 1 - 3).
    thats all, now you can deploy your application
    Regards,
    Ismet

  • How to use external jar files ??

    Hi all,
    In my user-defined function for mapping (IR) , I want to make use a Class which is available in an external .jar file.
    Our XI is working on Windows2003 OS. I set the classpath in OS environment variables.
    But it is not working.
    Where I should set the classpath ?
    Can anyone help.
    Thanks in Advance
    Chemmanz
    Message was edited by: Chemmanz

    Hi Chemmanz,
    For user defined functions, it is not necessary to use the external jar files.
    Just follow the below steps:
           1.      To create a new user-defined function, choose <b>Create New Function</b> in the data-flow editor at the bottom of the screen, on the left-hand side.
           2.      Specify the attributes of the new function in the subsequent window:
    Name:
    Technical name of the function. The name is displayed in the function chooser and on the data-flow object.
    Description:
    Description of how the function is used.
    Arguments:
    In this table, you specify the number of input values the function can process, and name them. All functions are of type String.
           3.      In the subsequent window, you can create Java source code:
                                a.      You can import Java packages to your methods from the Imports input field, by specifying them separated by a comma or semi-colon:
    You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since all message mappings require these packages and therefore import them.
    In addition to the standard packages, you can also specify Java packages that you have imported as archives and that are located in the same, or in an underlying software component version as the message mapping.
                                b.      Create your Java source text in the editor window or copy source text from another editor.
           4.      Confirm with Save and Close.
           5.      User-defined functions are limited to the message mapping in which you created the function. To save the new function, save the message mapping.
           6.      To test the function, use the test environment.
    The new function is now visible in the User-Defined function category. When you select this category, a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the function to the data-flow editor, choose the arrow next to the button and select from the list box displayed.
    Regards,
    Prasad U

  • Jar file in Web Dynpro Java Application!

    Hi All:
    I needed a Jar file in my WDJ App.
    I am using SP16.
    Can someone provide ideas/instructions on how to do this?
    Thanks in Advance!

    Create an external library DC, and stick the jar file into the libraries folder.  Create a public part of type compilation, and a public part of type assembly.  Add the jar file to both public parts.  Specify a compilation DC dependancy between the WD application and this DC.  That will solve your compilation problems.
    You also have to create a deployable DC, so you can get the jar file onto the server.  Create a J2EE library DC, and create an assembly usage dependancy to the external library DC.  Build the library DC, and the resulting ear file should contain the jar file.  Deploy the library DC to the server.
    Lastly, you'll also need to create a library reference between the WD application and the deployed library so the class loader can find the library at runtime.  That's done via project properties / Web Dynpro References / Library References.  Create a reference, and fill in the name of the J2EE library.  If you're unsure of the name, use the Visual Administrator to inspect all the libraries on the server - find your library, click on it, and look at the name in the right-hand panel - that's the name you need to use.
    Hope that helps.
    I also hope I got everything right

  • Adding external Jar's to Web Dynpro DC

    Hi All
               I want to add external jar's to a web dynpro development component but when i add the jar and rebuild the project by right clicking on project and then Development Component ===> Build / Refresh from DC settings then automaticaly the added jar's get removed
               Is there any other process to add the jar's in DC like what we do in normal dypro project. or what could be the issue.  I add the jar by properties ===> Java Build Path ==> Add External JAR's
            Please guide me I am totaly confused
    Thanks
    Ninad

    Put the ejb project in the projects required by the WebDynpro project (Java build path) in order to get it to compile succesfully.
    <b>Now you have 2 options:</b>
    1. You can then export your EJB methods as a web service and import these methods as a model in the WebDynpro project.
    <i>After this you can call your web service (ejb methods) from your webdynpro app.</i>
    2. Instatiate your EJB classes from jndi context as ejbs are normally used.
    Context initctx = new InitialContext();
    Object objref = initctx.lookup("java:comp/env/ejb/YOUR_EJB");
    YOUR_EJB_CLASS myEJB = (YOUR_EJB_CLASS) objref;
    <i>Call the methods from the myEJB object.</i>
    <u><b>If this solves your situation, points would be greatly appreciated.</b></u>
    Best regards,
    Homer Vargas
    SAP EP Development Consultant
    SAP Web AS Development Consultant
    SAP Andina y del Caribe

  • Problem with using external jar file

    Hi
    I was using mail.jar library for swing application to send and receive emails. It just works perfect when I run with netbeans. But when I run the executable jar file at dist folder it runs but mail related functions doesn't work.What should I do now to make it work with mail features outside netbeans.
    thanks
    vinay
    Edited by: 899657 on Dec 24, 2011 5:07 AM

    899657 wrote:
    No. Because I am running the jar file which is created by netbeansNetbeans creates a 'dist' directory in which it puts your jar and a "dist/lib' directory in which it puts the dependent jars that are added to the project using 'project right mouse click'->Properties->Libraries. I would expect to see this 'dist/lib' directory contain mail.jar and activation.jar and any other jars that your jar needs. Within your program jar's manifest I would expect to see the Class-Path attribute have relative reference these jars ( lib/mail.jar lib/activation.jar ) and for the Main-Class attribute define your main class.
    Given this setup then you should be able to just type -
    java -jar yourjar.jarto run your program.

  • Using jxl.jar in Java Web Dynpro using NWDS 7.0.09

    Hi ,
    I have a requiremnt to read excel file and I am trying to use jxl.jar for the same but I am facing issues which using it as External Library DC.During executing,I am getting NoClassFoundException.Please help .

    Hi
    Only one thing u missed that instead of Publishing as file you have to publish it as archive.
    Further u can check
    1. Publish as archive.for both compilation and assembly.
    2. Each changes require Build of the external library dc also.Build it and then run
    Best Regards
    Satish kumar

  • Re:using an XML file in Web Dynpro for java

    Hi all,
    I have pasted an xml file in Mimes->Components and my file name is Doc_List.xml after that i have done some manipulations using that file like this
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              DocumentBuilder db = dbf.newDocumentBuilder();
                                   Document doc = db.parse("//Doc_List.xml");
              String name = "description";
              NodeList nlst = doc.getElementsByTagName("name");
              Node node= nlst.item(0).getFirstChild();
              //node.setNodeValue(name);
                         String a = node.getNodeValue();
                                    wdComponentAPI.getMessageManager().reportSuccess(a);
    the exception iam getting is java.io.FileNotFoundException: /Doc_List.xml (No such file or directory)

    Hi,
       Place your xml file under the path src/mimes/Components/<your component name>. Then use the following code to read it:
    String xmlUrl = WDURLGenerator.getResourcePath
                                   (wdComponentAPI.getComponent().getDeployableObjectPart(),
                                    "FileName.xml"
    if(xmlUrl != null){
       Document doc = DocumentBuilderFactory.newInstance()
                                            .newDocumentBuilder()
                                            .parse(new File(xmlUrl));
       doc.getDocumentElement ().normalize ();
       // do further processing...
    Regards,
    Satyajit

  • How to use external jars in NW2004

    Hello Experts,
    can i use the same approach mentioned in the below Weblog for using the external jars in NW2004.
    /people/bertram.ganz/blog/2008/11/24/how-to-use-external-jar-files-in-web-dynpro-development-components
    and if not then what will be the best way to achieve it in  NW2004.
    Please provide your inputs on above.
    Regards,
    Siddharth

    Hi Sidharth,
    If you are using web dynpro DC perspective then you need to follow the following points to use the external jar files in it.
    1. Create a external library project.
    2. copy the external jars in the library folder os the projects.
    3.) Select all the jars from the u201CLibrariesu201D folder, Right click and then select Development Component and click on Add to Public Part
    4.Select the first Radio Button (Provides an API)and give some nameto it.
    5. Repeat the step no 3 but now select the second radio button other than as selected in step no 4.
    6. Now build your lirary DC.
    7. Now create a j2ee DC project.
    8. ) Expand the node DC Definition and Right Click on Used DC. Select Add Used DC.
    9. Select the External Library DC with build time dependency.
    10.Right click on the J2EE DC and then select Development Component followed by Build
    11. Right click on the J2EE DC and then select Development Component followed by Deploy
    now you can use both the libary DC and the j2ee DC in your web dynpro DC as used DC.
    But if you have created a web dynpro project only(but not DC) than you can directly add the external jars in java build path
    hope this will help
    regards
    Narendra
    Edited by: Narendra Singh on Oct 27, 2009 11:22 AM

  • Including external java libraries in Web Dynpro project

    I am trying to include some external jars in my web dynpro project.  By including in the project library, the web dynpro app compiles and runs fine.
    The issue is that the when I check in the project it doesnt activate in the build environment.  What is the best way to include these jars so that the project activate and compiles in the component build space?

    Hi Stephen
    There are two ways in adding the external JAR files in WebDynpro
    1) RightClick on the project - > properties-> Java Build Path - >Libraries ->Add External JAR Files
    By doing this , your jar will be available only on the local machine. if the path got changed or file got deleted , you will get errors.so to avaoid that
    2) Goto Navigation Tab - > navigate through <b>lib</b> directory and paster your .JAR file there
    By doing this your jar file will be deployed on to the sever ,so it will be available always as it is on the server
    Best Regards
    Chaitanya.A

  • Using a jar file in my application... how?

    I have a JAR file which contains some classes I need to use in my application. I however, after looking in several books, cannot figure out how to use this JAR file within my application.
    Do I simply put it in the directory with my .java files, and use an import command? I'm confused.

    If the classes in the jar are part of a package then you can import them based on the package structure. The jar file will have to be part of your CLASSPATH variable.
    i.e.
    myUtils.jar
    resides in C:\"My Classes"
    CLASSPATH = .;"C:\My Classes";"C:\My Classes\myUtils.jar"
    within the jar I have the following class:
    \ameyer\Util\someUtil.class
    \ameyer\Util\anotherUtil.class
    To use these classes I could use the following import statement
    import ameyer.Util.*;
    This would import any class at that level in the jar.
    Note: the import part of the CLASSPATH is "C:\My Classes\myUtils.jar"
    hope this helps.

  • Using an External Jar file

    I was hoping my intro programming class would be easy, as I've done some C++ before, but go figure, it's not.
    Although the language/concepts aren't to difficult to learn, it seems compiling programs is. For one program, I'm giving an external .jar file to use. I'm using crimson editor and I do have it setup with the jdk1.6.0. It compiles all my other programs besides this one (command line doesn't work either).
    Essentially, I've created a project, I have an instantiable class, and an application class. I can call the instantiable class in the app class and creating/modifying objects works just fine. Then I have a .jar file added to the project that came from the class (supposed to be used for I/O, don't know why we can't just use the standard java classes, but oh well). anyways, when I try to call the methods in the .jar file I get the following error:
    ---------- Capture Output ----------
    "C:\Program Files\Java\jdk1.6.0\bin\javac.exe" file.javafile.java:6: cannot find symbol
    symbol : variable externalJar
    location: class file
              int value = externalJar.getIntInput();
              ^
    After doing some searching, I found that it might be due to the classpath. So I set the classpath to the directory.. no go. Then I set the classpath to the externalJar.jar file and I get the follow error:
    ---------- Capture Output ----------
    "C:\Program Files\Java\jdk1.6.0\bin\javac.exe" -classpath C:\folder\externalJar.jar file.javaerror: error reading C:\folder\externalJar.jar; error in opening zip file
    I'm at a loss. It works when I use Eclipse and I can just add the external jar file, but I don't want to use eclipse, it's slow and bulky. Any other solutions to this problem? Thanks.
    E-Rod
    *names were changed for a reason.. i already know i'm not misspelling anything                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The error about not being able to find the variable externalJar has nothing
    to do with the classpath. It's just that your code in file.java refers to this variable,
    but you have not declared it anywhere.
    Variables within a class, the names of classes and the names of .jar files
    which contain packages have nothing whatsoever to do with one another.
    If you are using a variable externalJar intending it to reference your external jar
    file in some way, then your file.java code is seriously wrong.
    (Also, classes and their associated source files should begin with an
    uppercase letter.)
    Regarding your attempt to specify the classpath when you invoke the
    compiler (always a good idea), I think you should also include the current
    directory (if that is where file.java is). Like this:"C:\Program Files\Java\jdk1.6.0\bin\javac.exe" -classpath C:\folder\externalJar.jar;. file.javaThe "error opening zip file" thing is odd. Make sure you are
    able to read it (permissions OK, no other process has it locked). And that
    it's not corrupt (Did you create it? If so, rebuild it. If not, aquire another copy.)
    Sorry for the generalities and guesswork, but without seeing any code and
    without knowing your directory structure or the contents of this externalJar.jar
    it's hard to do any more.

  • NoClassDefFoundError : when I am using MDM jar file

    Hi All,
    In my Webdynpro Java application, I need to acces the MDM Data. i have to use these jars,
    mdm-data.jar
    mdm-protocol.jar
    mdm-admin.jar
    mdm-common.jar
    mdm-core.jar
    MDM4J.jar
    and i getting this Error, while deploying the application to server.
    java.lang.NoClassDefFoundError: com/sap/mdm/net/ConnectionAccessor
    I guess, the reason may be that I dont have these above JARs in the server.
    Please give me a solution as soon as possible.
    Thanks,
    Boopathi.

    Dear Bhoopathi,
    You are getting classnotfound exception because, the external jar file you are using is available only at designtime (ie. Only in NWDS), and not available for runtime (ie. in J2ee server). To make it available in runtime, you have to deploy the jar file to J2ee server, so that the classes available in jar file will be available at runtime also.
    If the project is a simple webdynpro project, then, copy the jar file in to lib folder of the project and add the jar file in build path of the project. When this project is deployed, the jar file will also be available along with project. But, this jar file will be available only for this webdynpro project.
    If the project is a dc project, you have to deploy this jar file as a separate dc, and refer this dc in you dc project.
    Since jar file cannot be deployed directly, we have to bundle this jar to ear file,as a library.Once this library dc is deployed, you can use the same library dc in other dc projects also.
    For deploying external jar to J2ee engine, refer this link
    Bid adieu to bots - using CAPTCHAs
    I prefer this link, because it worked for me.
    If it is not working, refer this..
    A bit of (impractical) scripting for Web Dynpro
    Thanks,
    Fahad Hamsa

  • Import data from excel/csv file in web dynpro

    Hi All,
    I need to populate a WD table by first importing a excel/CSV file thru web dynpro screen and then reading thru the file.Am using FileUpload element from NW04s.
    How can I read/import data from excel / csv file in web dynpro table context?
    Any help is appreciated.
    Thanks a lot
    Aakash

    Hi,
    Here are the basic steps needed to read data from excel spreadsheet using the Java Excel API(jExcel API).
    jExcel API can read a spreadsheet from a file stored on the local file system or from some input stream, ideally the following should be the steps while reading:
    Create a workbook from a file on the local file system, as illustrated in the following code fragment:
              import java.io.File;
              import java.util.Date;
              import jxl.*;
             Workbook workbook = Workbook.getWorkbook(new File("test.xls"));
    On getting access to the worksheet, once can use the following code piece to access  individual sheets. These are zero indexed - the first sheet being 0, the  second sheet being 1, and so on. (You can also use the API to retrieve a sheet by name).
              Sheet sheet = workbook.getSheet(0);
    After getting the sheet, you can retrieve the cell's contents as a string by using the convenience method getContents(). In the example code below, A1 is a text cell, B2 is numerical value and C2 is a date. The contents of these cells may be accessed as follows
    Cell a1 = sheet.getCell(0,0);
    Cell b2 = sheet.getCell(1,1);
    Cell c2 = sheet.getCell(2,1);
    String a1 = a1.getContents();
    String b2 = b2.getContents();
    String c2 = c2.getContents();
    // perform operations on strings
    However in case we need to access the cell's contents as the exact data type ie. as a numerical value or as a date, then the retrieved Cell must be cast to the correct type and the appropriate methods called. The code piece given below illustrates how JExcelApi may be used to retrieve a genuine java double and java.util.Date object from an Excel spreadsheet. For completeness the label is also cast to it's correct type. The code snippet also illustrates how to verify that cell is of the expected type - this can be useful when performing validations on the spreadsheet for presence of correct datatypes in the spreadsheet.
      String a1 = null;
      Double b2 = 0;
      Date c2 = null;
                        Cell a1 = sheet.getCell(0,0);
                        Cell b2 = sheet.getCell(1,1);
                        Cell c2 = sheet.getCell(2,1);
                        if (a1.getType() == CellType.LABEL)
                           LabelCell lc = (LabelCell) a1;
                           stringa1 = lc.getString();
                         if (b2.getType() == CellType.NUMBER)
                           NumberCell nc = (NumberCell) b2;
                           numberb2 = nc.getValue();
                          if (c2.getType() == CellType.DATE)
                            DateCell dc = (DateCell) c2;
                            datec2 = dc.getDate();
                           // operate on dates and doubles
    It is recommended to, use the close()  method (as in the code piece below)   when you are done with processing all the cells.This frees up any allocated memory used when reading spreadsheets and is particularly important when reading large spreadsheets.              
              // Finished - close the workbook and free up memory
              workbook.close();
    The API class files are availble in the 'jxl.jar', which is available for download.
    Regards
    Raghu

Maybe you are looking for

  • Time characterstis format in flat file

    hi all, can any one plz tell me the how we can give the format for time characteristics in flat file.. thanks & Regards

  • Searching for Flash Photo Gallery with numbered navigation menu.

    I'm looking for a photo gallery with a numbered navigation menu. I've seen this gallery on several flash web pages. Is this type of photo gallery a template that comes with flash? Has anyone come across a tutorial for a photo gallery similar to the l

  • Nokia 5800: Can I use EU version in US?

    Noob question maybe, but I use Tmobile and their 3G will NOT be compatible with either the US or EU version of the 5800. That's OK b/c I really only care about music AND style (I like the EU colors). So, all things considered, ex 3G, will the EU vers

  • Time Capsule not working after a restore

    I recently had to restore from my TM/TC backup after a standard software update made it so I could no longer log into my account. Now, my TC is not working properly. I can still access all of my past updates on mu TC, but it is not working for making

  • "error LNK2019: unresolved external symbol" help......!

    Hi, i'm still newbie with Oracle 10g and VC8. The problem is i found this LNK2019 error when build my project. Here the steps i take when run VC8 for the first time: (1). In PROJECT->PROPERTIES->CONFIGURATION PROPERTIES->C/C++->ADDITIONAL INCLUDE, i