Using WD APIs in Java Programming

Hi,
     First let me explain my scenario:
          I have to get the <b>attachments in a PDF document</b>, using a <b>java program</b>. I am using Java perspective of NWDS. I am using the APIs
->IWDPDFDocumentHandler
->IWDPDFDocumentAccessibleContext
->IWDPDFDocument
->IWDPDFDocumentAttachment
in my program.
When I run my java program, I am getting the <b>java.lang.NoClassDefFoundError</b>.  Can you please, give me a solution for this problem?
Note :  I have added the necessary JAR files to the project.
Thanks,
Prabhakar.

Hi Sumit,
   Here is the result which I got in the console,
java.lang.NoClassDefFoundError: com/sap/tc/webdynpro/services/exceptions/WDRuntimeException
     at PDFAttachment.readAttachmentFromPDF(PDFAttachment.java:241)
     at PDFAttachmentMain.main(PDFAttachmentMain.java:21)
Exception in thread "main"
Note :
PDFAttachment
- Class
readAttachmentFromPDF
- method
The code is,
String PDFDocName = "podetailswithAttachment.pdf";
                    //wdComponentAPI.getMessageManager().reportSuccess("Outside try FileName :"+PDFDocName );
                    try
                         //wdComponentAPI.getMessageManager().reportSuccess("Inside try FileName :"+PDFDocName );
                         FileInputStream fileInpStrm = new FileInputStream("C:\"+PDFDocName);
                         FileOutputStream fileOutStrm;// = new FileOutputStream()
                         ByteArrayOutputStream bo = new ByteArrayOutputStream();
                         int c;
                         while ((c = fileInpStrm.read()) > -1)
                              bo.write(c);
                         byte[] pdfSource = bo.toByteArray();
// Line :240     
                         IWDPDFDocumentHandler pdfdocHandler =WDPDFDocumentFactory.getDocumentHandler();
                         IWDPDFDocumentAccessibleContext pdfdocaccContext = pdfdocHandler.getDocumentAccessibleContext();
                         pdfdocaccContext.setPDF(bo);
                         IWDPDFDocument pdfDocument = pdfdocaccContext.execute();
                         IWDPDFDocumentAttachment[] pdfatt =   pdfDocument.getAllAttachments();
                         //wdComponentAPI.getMessageManager().reportSuccess("Length of the attachments: "+pdfatt.length);
                         //pdfdocaccContext.setPDF();
                    catch(Exception e)
                         //wdComponentAPI.getMessageManager().reportSuccess(""+e);
                         System.out.println(""+e);
Thanks,
Prabhakar.

Similar Messages

  • How to use excel api in java?

    I need to use excel api in Java to generate data in excel format. Can any one tell any of the use ful Excel api that we can down load from net? i have read about Apache's POi-hssf-Java api. But the jar i downloaaded from Apache site is not working ? Can anybody please send me the jar for taht Api ?

    Hi,
    In fact i was not clear about whcih jar file to download from the apache site. i found one folder structure like this
    -parent
    -bin
    -src
    All these folders contained some zip files. i took the zip files and extracted them. And i set teh class path also . But when i tried to import in java programs ,these jar files are giving compilation errors

  • Can't use certain characters in java programs.

    For some reason I cannot use characters like: " ^ ~ | " in java programs.
    I can type them in a terminal and then paste them into the program, but cannot type them inside the java program - It's has been like that in every java application I have used. It only works when typing them in a applet running on a browser.
    Im running Linux RH 7.2 with JDK1.4.0 (It works fine in windows 2000)
    Hope somebody can help me.
    /Tommy

    Ehmm. What makes you believe that it isnt?
    I can't make exclusiveOr operations and if(bubba || bubba2) something....And that is a problem / annoyance.
    I can type every other characters but those ��� works fine as well.

  • Using Windows API in Java

    hi,
    How can i use windows api in java.
    regards
    Malik Faisal

    By writing a wrapper in JNI.
    JNI Tutorial.

  • How to Use native keyword in java programming

    Hi ,
    I am using JDK 1.6.0_11 , and i was trying to create a java program using "native" keyword ,
    i got the sample code for the same from the site : - http://www.javaworld.com/javaworld/javatips/jw-javatip23.html
    But when i type this command " C:\javah -stubs Happy " following error occurs
    " Error: JNI does not require stubs, please refer to the JNI documentation. "
    then typed " c:\javah -jni Happy" without any error .
    After that i wrote a HappyImpl.c as mentioned in the above tutorial
    #include <StubPreamble.h> /* Standard native method stuff. */
    #include "Happy.h" /* Generated earlier. */
    #include &ltstdio.h> /* Standard C IO stuff. */
    void Happy_printText (struct HHappy *this)
    puts ("Happy New Year!!!");
    then it is not compling and error is
    "unable to open included file StubPreamble.h file
    unable to open included file Happy.h file "
    Please help me . i want to use native method , i did exactly the same in tutorial at above link.
    Thanks & Regards
    Mannat

    you do need to know how to use your C compiler... It quite clearly can't find those files which indicates that you didn't tell it where to find them.

  • Why jdbc api ?why not use odbc api from java application?

    hi guys....am pretty confused abt these jdbc drivers...am unable to understand why we r using jdbc api when odbc api has been in market prior to jdbc.....please clarify my doubt

    chari wrote:
    hi guys....am pretty confused abt these jdbc drivers...am unable to understand why we r using jdbc api when odbc api has been in market prior to jdbc.....please clarify my doubtbecause jdbc is the way that java does it.
    use it or don't.
    C++ was in the market before java - why was java developed at all? cobol was in the market before C++ - why was C++ developed at all?
    %

  • Data Warehouse:java.lang.NoClassDefFound Error while using OWB API for Java

    I was writing code to use the OWB APIs for Java:
    I have imported the folowing files:
    oracle.owb.connection.RepositoryManager;
    oracle.owb.connection.OWBConnection;
    oracle.owb.connection.ConnectionFailureException;
    when jvm tries to get instance of Repositary Manger by the following code
    reposManager = RepositoryManager.getInstance();
    I get the following exception:
    Exception in thread main
    java.lang.NoClassDefFoundError: com/objectspace/jgl/HashMap
    I have checked my OWB and Java environment but I cant locate com/objectspace/jgl.jar file. Can some one tell me were this jar is located in so i can import it.

    Either use some criteria you develop related to one of the keys on the table or use some sort of record limiting method.
    Note the method of limiting will vary related to the database you are using. You will have to look at the documentation.
    For example I am told this will work in MySQL to get 200 records starting at record 100.
    SELECT * FROM myTable ORDER BY whatever ASC LIMIT 100,200
    Because you are running out of memroy I assume the table is large,
    I am not sure what the impact of the above will have on performance because if in the above if the order by is not based on an index at the server level all the records will be selected and sorted before the records are limited.
    I would make sure you have an appropriate index.
    If you use the advanced search over the user forums using "resultset paging" and possibility the database you are using you should be able to get some ideas.
    I hope this makes sense to you.
    rykk

  • Java.lang.NoClassDefFound Error while using OWB API for Java

    I was writing code to use the OWB APIs for Java:
    I have imported the folowing files:
    oracle.owb.connection.RepositoryManager;
    oracle.owb.connection.OWBConnection;
    oracle.owb.connection.ConnectionFailureException;
    when jvm tries to get instance of Repositary Manger by the following code
    reposManager = RepositoryManager.getInstance();
    I get the following exception:
    Exception in thread main
    java.lang.NoClassDefFoundError: com/objectspace/jgl/HashMap
    I have checked my OWB and Java environment but I cant locate com/objectspace/jgl.jar file. Can some one tell me were this jar is located in so i can import it.

    Do you have JAVA_HOME set in your environment?
    What's the result of
    env
    Make sure DBCA is calling the java under $ORACLE_HOME not from other installation.

  • Displaying japanese chars using servlet (posted in Java programming too)

    I am trying to display the japanese characters inputed by the user using
    html form and I am using servlet...
    After reading the input and when i try to display i get ????
    how can i solve this.
    It was originally posted in Java Programming forum. but i think the question suits here....heres the link for original post
    http://forum.java.sun.com/thread.jspa?threadID=670419&tstart=0
    sorry for posts at two different forums

    After reading the input and when i try to displayDisplay on what?
    Usually, if request.getCharacterEncoding() doesn't return viable result, then you should call
    request.setCharacterEncoding() with a proper value. If user send Shift_JIS string as form
    input, then the argument value should be also "Shift_JIS". When in doubt, use "UTF-8".
    Then, you call response.setContentType("text/html; charset="Shift_JIS"), etc.

  • Decrypt file using AES(32) by java program ?

    I have encrypted file using AES 32 bit and i have key. So I want to decrypt the file using Java program/ cryptography standards with that key.
    Anybody help highly appreciated.

    Yes that would make sense, cheers:
                 fw2.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"");
                 fw2.write("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
                   fw2.write("<html>");
                   fw2.write("<head>");
                   fw2.write("<title>Output</title>");
                   fw2.write("<link href=\"Styles.css\" rel=\"stylesheet\" type=\"text/css\">");
                   fw2.write("</head>");
                   fw2.write("<body>");
                   fw2.write("<div id='Border'>");
                   fw2.write("<div id='Background'>");
                   searchForSubFolder(file);
                   fw2.write("</div>");
                   fw2.write("</div>");
                   fw2.write("</body>");
                   fw2.write("</html>");This is working to some extent although the formatting from the css file is not working. Any ideas why this is? I am using divs determined by thee css to do things like the background colour.
    Thanks

  • How to send automated mail using Weblogic API ,,,,,, NOT Java Mail API.

    Hi All,
    I need to send an automated mail using BEA Weblogic API, can you please let me know how to accomplish this task,
    I will be heartly thankful to you,
    waiting for your response back
    naveen

    does it uses weblogic API ,, is thre any other way to do the task apart from email controls ,,,, because we are using timers and email control uses event genrators.

  • Use of netweaver in java programming

    Hi!
       I want to know the use of netweaver in java application as compare to other IDE's.
                        Thnk u

    Hi!
    I guess you mean the NetWeaver Developer Studio (NWDS) - which is the IDE - and not the NetWeaver Platform. The NWDS gives you access to the Java Development Infrastructure allowing to manage the lifecycle & delivery of applications, supports SAP specific project types like Web Dynpro, Portal Development, Mobile Applications, Dictionary aso.
    Like other IDEs it offers support development and deployment of J2EE-applications (EJB, Web), but only works with SAPs J2EE-engine.
    To be honest I don' t think there' s a reasonable comparison to other IDEs possible. You get more information from the development manual on help.sap.com.
    Regards,
    Thomas

  • How can I use MS Word within java programming

    Hi everyone!
    I am developing a Java program that will take data
    from an Access 2000 database, and manipulate it,
    display the results graphically and in tables. The
    challenge for me is that I want the program insert the
    graphics and tables into the MS Word template and then
    prompt me to save it as a word * .doc. Do you know
    of any articles or sources of sample code on how to do
    this. The Java environment is Java2, JDK 1.3,
    JBuilder4. The OS environment is XP.
    Regards,
    Farad

    Hi, I also need that package. my e-mail is [email protected] Plese send me that. Thanks in advance
    I have a package that will do this for you. I just
    need to get your email to send an attachment and
    examples.

  • How to use java api while java programming especially using javase and java swing?

    i need help for java api for undo, redo, htmleditorkit,editorkit.
    in my project i have to use java swing for desktop application but, i need help for how to implement and how to retrieve java api.
    please reply with example or code..

    i need help for java api for undo, redo, htmleditorkit,editorkit.
    in my project i have to use java swing for desktop application but, i need help for how to implement and how to retrieve java api.
    please reply with example or code..
    You find examples and code by searching the internet, not by using forums.
    Start with The Java Tutorials - it has trails for the bulk of the Java functionality.
    See the trail 'How to Write an Undoable Edit Listener'
    http://docs.oracle.com/javase/tutorial/uiswing/events/undoableeditlistener.html
    You learn by DOING - not by reading. Actually DO the tutorial example and try to understand WHAT it does and HOW it does it.
    Then search for other tutorial trails that are of interest.

  • Is it possible to use iFS API within java stored procedure?

    question:
    is it possible to use the iFS API for file handling
    within a java stored procedure (which is invoced by a trigger)?
    is there an "elegant" workaround if it is not possible?
    problem:
    my java code using the iFS API works fine outside
    the java stored procedure
    but invoked via trigger as java stored procedure
    it throws following exception:
    IFS-20102: Unable to start service (IfsDefault)
    i am using:
    oracle 9.0.1
    oracle internet file system 9.0.1.1.0
    windows 2000
    thanks

    thanks for your help
    i looked through the applications developers guide
    the basics behind advanced queueing (as far as i understand) is:
    program A inserts a message into the queue - and program B gets message from the queue and processes it
    question 1:
    but what is the difference between advanced queuing and a queue i create by myself
    (simply with a database table) and let application B (which runs in a loop)
    check if the queue is filled
    or am i missing something important which makes advanced queuing more practicable for my problem?
    question 2:
    you wrote about advanced queuing support in iFS 9.0.3, but the newest version i found was iFS 9.0.2
    did you reffer to the advanced queuing mechanism in general or to a spezial queuing feature in iFS 9.0.3?
    thanks

Maybe you are looking for

  • Grouping channels in Audition?

    Hi, Ok, I seem to be looking for an answer to this question by asking the wrong questions. I am moving to a new setup and my studio and using Audition CC to record but I seem to be lacking the proper Audition terminology..... What I want to do is tak

  • Question about Quality Gate Management

    Hi Solman profis, I have questions about the transport requests in QGM. My Solution Manager is 7.1. I have a Solman project, in which I activated QGM and created a Change and created two transport requests (one workbench, one customizing) attached to

  • Height of ALV Header

    I have created ALV Tree using custom container. Now i want to rstrict the Height of the top of page as top of page containes too many rows hence in the whole report only the Header is displayed. Can you tell me the method for to rstrict the Height of

  • Cisco EIM 9.0.2 web page can not be displayed

    Hi Dear, We are using two server (web and application) Application and db same server and also we are using standalone installation. it was working fine this morning but we did install new  version 99 license after that we can not access web Its give

  • Opening hang reports

    My main problem is, after recently upgrading to Leopard I get frequent hangs in Safari (sometimes other applications too, but unlike Safari, these usually resolve themselves in a few seconds). Hoping to post a couple of the hang reports (are these th