Problem with method "write" in POI Library.

Best regards, I have the following problem: I have a application in Oracle BPM 10g, that generates a file in Excel. First it upload a template, then query the data base, and storage this data in "POI Object" of type "XSSFWorkbook"; all of the this, at memory.
The problem is when I try to write this object  "XSSFWorkbook", in the file(generate a Physical File), the file size is about 35 MB, usgin the method wb.write(out) of the "POI Library", my server spend about 15  minutes, generating blocks.
I' like that some help me to solve this problem, maybe making any setting in my server.
My Servers are:
Application Server: Oracle WebLogic 10.3.1
and File Server: Oracle Linux. Memoy: 32GB
I show you the code in java:
            rsQuery = generarTablas(sStoredProcedure,xmlTableroControl);
            InputStream inp = JExcel.cargarPlantillaLectura(sRutaOrigen + sNombreOrigen + ".bck");
           XSSFWorkbook  wb = new XSSFWorkbook(inp);  //DESCOMENTAR
          wb.setForceFormulaRecalculation(true);
            int vnHoja = 0;
            String vsTabla = "";
            while(rsQuery.next()){
                vnHoja  = rsQuery.getInt(1);
                vsTabla = rsQuery.getString(2);
                outResultado = new BufferedWriter (new FileWriter("/tmp/"+String.valueOf(nOrden)+vsTabla+".txt"));
                outResultado.write("vsTabla: "+vsTabla+" Hoja : "+String.valueOf(vnHoja)+  "\n"+String.valueOf(Util.getTodayTime()));
                outResultado.close();
              nOrden ++;
                this.rsConsulta = consultar(vsTabla);
              if(_getRowCount(this.rsConsulta)>0)
                    generarHoja(wb, 6, vnHoja);
                    this.rsConsulta = null;//agregado 12/06/2013
             File tempFileXLS = File.createTempFile(sNombreDestino + this.sFechaFin + "_", ".xlsx");
            ruta = sRutaDestino + tempFileXLS.getName();
            OutputStream out = new FileOutputStream(ruta);
            inp.close();
            wb.write(out);//---------------------> PROBLEM

Best regards, I have the following problem: I have a application in Oracle BPM 10g, that generates a file in Excel. First it upload a template, then query the data base, and storage this data in "POI Object" of type "XSSFWorkbook"; all of the this, at memory.
The problem is when I try to write this object  "XSSFWorkbook", in the file(generate a Physical File), the file size is about 35 MB, usgin the method wb.write(out) of the "POI Library", my server spend about 15  minutes, generating blocks.
I' like that some help me to solve this problem, maybe making any setting in my server.
My Servers are:
Application Server: Oracle WebLogic 10.3.1
and File Server: Oracle Linux. Memoy: 32GB
I show you the code in java:
            rsQuery = generarTablas(sStoredProcedure,xmlTableroControl);
            InputStream inp = JExcel.cargarPlantillaLectura(sRutaOrigen + sNombreOrigen + ".bck");
           XSSFWorkbook  wb = new XSSFWorkbook(inp);  //DESCOMENTAR
          wb.setForceFormulaRecalculation(true);
            int vnHoja = 0;
            String vsTabla = "";
            while(rsQuery.next()){
                vnHoja  = rsQuery.getInt(1);
                vsTabla = rsQuery.getString(2);
                outResultado = new BufferedWriter (new FileWriter("/tmp/"+String.valueOf(nOrden)+vsTabla+".txt"));
                outResultado.write("vsTabla: "+vsTabla+" Hoja : "+String.valueOf(vnHoja)+  "\n"+String.valueOf(Util.getTodayTime()));
                outResultado.close();
              nOrden ++;
                this.rsConsulta = consultar(vsTabla);
              if(_getRowCount(this.rsConsulta)>0)
                    generarHoja(wb, 6, vnHoja);
                    this.rsConsulta = null;//agregado 12/06/2013
             File tempFileXLS = File.createTempFile(sNombreDestino + this.sFechaFin + "_", ".xlsx");
            ruta = sRutaDestino + tempFileXLS.getName();
            OutputStream out = new FileOutputStream(ruta);
            inp.close();
            wb.write(out);//---------------------> PROBLEM

Similar Messages

  • UNIX Problem with method Runtime exec(String[],String[],File)

    Hello !!
    i'm french
    scuse my english
    I got a probleme with method exec(String[],String[],File) of Runtime Class
    i don't have any probleme when my program runs on Windows NT but the same program on UNIX doesnt execute my command..
    When i use exec(String[]) methode i dont have this problem ...but i need the second one methode because i have to execute my command in a different directory than the JAVA program.
    I need that results of this command are placed in this drectory so that i can't use an exex() like that :
    exemple with a perl :
    "perl /toto/titi/hello.pl"
    I want to execute this :
    "perl hello.pl" (and hello.pl is placed in /toto/titi)
    Conclusion :
    the exec(String[],String[],File) solution is ok with NT ...
    but with UNIX ????
    Is there other solution ??
    Should i do a "cd" command before my execution ? how can i do this ??
    Thanks !!!!

    Could you post your source code (only relevant part)
    Raghu

  • Having a problem with eBooks in my iTunes library.

    As the title says, I'm having some problems with the iTunes library not reflecting what's actually on the disk.
    I add the ebook and it seems to add ok.  The file gets consolidated into /mymusic/books under the author correctly, but the book is missing from the library.  The book is in ePub format, and seems to have the right file extension and shows up as a file of "ePub" type in windows explorer.
    Any ideas?  Is there a way to re-build the library or a portion of it?

    Hi tony paine,
    Welcome to the Support Communities!
    The article below may be able to help you with this.
    Click on the link to see more details and screenshots. 
    iCloud: Keeping the Junk folder consistent between iCloud Mail and OS X Mail
    http://support.apple.com/kb/HT4911
    Cheers,
    - Judy

  • Problem with Export Project as New Library

    Getting some behavior from Aperture that I do not understand.
    I am running Aperture 3.5.1 on OSX 10.9.1 on both a MacPro and a MacBookPro(Retina). 
    Both machines are believed to be completely up-to-date software-wise (no indication in App store that software updates are available.  i don't know how else to look.).
    I imported (Nikon D800) raw images from an SD card to MacBookPro Aperture Library (which contains few images), performed adjustments (and "shared" some with my SmugMug account).
    Then I selected the Project that contained my images, chose File, Export, Project as New Library (in order to move the adjusted images to my MacPro, where my "real" Aperture Library resides).  (first time i have attempted such a workflow).  I selected all 3 options (Copy originals . . ., Copy previews . . ., Show alert) and clicked Export Library.
    I copied the resulting file to my MacPro.  After choosing File, Import, Library (in Aperture on the MacPro), I see it "Merging", and then the project in question appears in the Library on the MacPro.
    The problem is that each image has a message at the top of the Adjustments pane:  "This photo was adjusted using an earlier version of Apple's RAW processing", and they all come into the receiving library with no adjustments, and no previews - not even the built-in preview that a raw file should carry (the images show in the viewer as _really_ flat, gray - very strange, i have never seen this appearance before, though I routeinely use raw format).
    Trying to troubleshoot, I went back to the MacBookPro and closed Aperture, then double-clicked the Library on the desktop that had resulted from the export process (containing only one project).
    Same situation.  All of the images think they were processed on older raw processor (even though this library is being opened on the same computer that did the processing).
    Any ideas?  Is this a bug, or have I misunderstood the point of exporting Projects?

    There have been two problems, reported, when exporting projects as library:
    In earlier versions of Aperture the exported library did not include all images, if images had been imported from Photo Stream. I cannot reproduce this bug any longer with Aperture 3.5.1.
    The export could go wrong, if the aperture library needed repairing.
    Have you tried the Aperture Library First Aid Tools,to fix a possible library curruption?
    See this link:  Aperture 3 User Manual: Repairing and Rebuilding Your Aperture Library
    Before trying to rebuild, make sure, your backup of your Aperture library is current and in a working condition.
    I see a progress bar and the .exporting library is created in the desired location.
    Finally I decided to watch a project closely as it was being exported as a library and I noticed that the file size jumps up an down. I'm not an expert on how export works, but it would appear that each exported photo is overwriting the previous one.
    What is the desired location? Are you exporting to your internal system drive or to an external drive? If external, how is the drive formatted?  Such overwriting of files could be caused by incompatible filesystems creating conflicting pathnames. Make sure, the destination is a filesystem formatted MacOS X Extended (Journaled).
    -- Léonie

  • Problems with songs skipping in ITunes Library

    I recently transferred my Itunes from an old PC based computer to a new PC based laptop (GateWay M Series - Windows Vista). After that I upgraded to Itunes 8.1. I am now experiencing the problem with songs in my Library skipping after about 5 seconds into the song. I have my library sorted alphabetically, sometimes after the 5 seconds it skips down 10-15 songs before it lands on one that it plays all the way through. In one instance it played all the way through on 3 songs from the same album - only to start skipping after 5 seconds into the 4th song. It doesn't happen on every song. There doesn't seem to be a rhyme or reason to the types of songs this happens with - some of them were purchased songs, some were from CDs. I tried uninstalling the Library and then reinstalling - figuring that my library was corrupted. But - it is still doing it - only now it is doing it on different songs than before. Again no rhyme or reason. Has anyone else experienced this? Any ideas on what I can do to fix this!! My husband and son were able to transfer their libraries from the old PC to their new PC laptops and they haven't had this problem with their libraries!

    Similar problem here, running OS X 10.5.6 and iTunes 8.1.1. Any suggestions?

  • Problems with packages, classpath and BouncyCastle Library

    Hi everybody!
    Shortly, after adding BC's crypto library to my MOBILE (J2ME) project, when I build it returns a NoClassDefFoundError about java.math.BigInteger class.
    Its package is the same of J2SE but is included in this library. Now, this should not be a problem, 'cause java.math.BigInteger is not included in J2ME, and library's release is (I'm sure) for J2ME...I think it's a problem of classpath but I can't find a way to go on with my project!
    Please, if anybody knows where I'm wrong let me know!!!
    ...and sorry for my bad english...;-)
    b4kk3

    I think the update is buggy. Many people (inc. me) are having problems with it. Am not able to play any songs/videos .. terrible !

  • Problem with CSV file and Ostermiller library

    Hello, I'm using Ostermiller library to generate file with csv format.
    The problem is that this library seems to have a bug when it comes to data including the character carriage return.
    For example I try to record a file with the following data:
    Field1 = Text1
    Field2 = This is
    a long text including
    carriage return
    characters
    Theoritically the file should looks like this:
    Text1,"This is
    a long text including
    carriage return
    characters"
    But the library creates the following:
    Text1, This is\ra long text including\rcarriage return\rcharacters
    The \r you can see in not 0x0D but 0x5C 0x72 !!!!!!
    This is not a correct CSV format and then I cannot reopen the file correctly with Excel.
    Did you already see this problem with this library?
    Any idea?

    Even when i use ExcelCSVPrinter the text appears as -
    5,1,First aid course,234,,"Boeing Everett Plant \nRoom No 108",2007-11-26,02:15:00,,04:15:00,Scheduler S.,Resourcing,,hiii abc
    when I open this text in notepad. It formats properly when I open in excel as follows
    5,1,First aid course,234,,"Boeing Everett Plant
    Room No 108",2007-11-26,02:15:00,,04:15:00,Scheduler S.,Resourcing,,hiii abc
    IS there something else that I need to do?

  • Problem with Method environment_get_variable (Windows GUI)

    Hello,
    I want to use the Method "cl_gui_frontend_services=>environment_get_variable".
    I try this coding with same keywords ('%TMP%', 'TMP', ...), but the result is ever sy-subrc = 0 und s_path is initial.
    DATA s_path TYPE string.
          CALL METHOD cl_gui_frontend_services=>environment_get_variable
            EXPORTING
              variable             = 'USERPROFILE'
            CHANGING
              value                = s_path
            EXCEPTIONS
              cntl_error           = 1
              error_no_gui         = 2
              not_supported_by_gui = 3
              OTHERS               = 4.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    Please, can every body tell what is wrong.
    Thanks

    hi,
    seems to be a problem with java environment...
    see link and note
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_fes/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d31303237303133%7d]
    take a look at the env-variable:
    QTJAVA=d:Javajre1.5.0_11libextQTJava.zip
    and try to change it to older relase (1.4!)
    Bye

  • Problems with DVD writer

    I recently built a new machine with a P965 Platinum MB.  I put in a Optiarc AD7170 DVD writer.  Even though I was able to install windows XP with it, I immediately had problems once windows XP was up and running.  The MSI utility CD wouldn't run.  Windows explorer would hang up.  I would also get some fatal windows errors.  I replaced the DVD writer with a CD writer that I had laying around and everything was fine. 
    I put the DVD writer in my older machine and it works fine.  I also had a friend try it in his and everything was OK.
    I couldn't find anything on the web about this particular brand.  There was some mentions in this forum about JMicron.  Could there be some incompatibility with the writer and the motherboard or the JMicron controller?

    I have a similar but actually quite different problem.  My p965platinum's BIOS won't even show my IDE drives,  sometimes,  well most of the time..
    OS Name   Microsoft Windows XP Professional
    Version   5.1.2600 Service Pack 3 Build 2600
    OS Manufacturer   Microsoft Corporation
    System Name   
    System Manufacturer   MICRO-STAR INTERNATIONAL CO.,LTD
    System Model   MS-7238
    System Type   X86-based PC
    Processor   x86 Family 15 Model 4 Stepping 1 GenuineIntel ~2999 MHz
    BIOS Version/Date   American Megatrends Inc. V1.8, 12/1/2007
    SMBIOS Version   2.5
    Windows Directory   C:\WINDOWS
    System Directory   C:\WINDOWS\system32
    Boot Device   \Device\HarddiskVolume1
    Locale   United States
    Hardware Abstraction Layer   Version = "5.1.2600.5512 (xpsp.080413-2111)"
    User Name   
    Time Zone   Mountain Daylight Time
    Total Physical Memory   2,048.00 MB (Corsair XMS2 DHX [matched pair] 2 x 2GB DDR2 6400C4DHX cas5) running 5,5,5,18
    Available Physical Memory   1.43 GB
    Total Virtual Memory   2.00 GB
    Available Virtual Memory   1.96 GB
    Page File Space   3.85 GB
    Page File   C:\pagefile.sys
    I have reset the CMOS several times and once in a great while the IDE and the devices,  1 WD60GB HDD and 1 Asus 1814 DVDR/RW,  will show and work.   I have changed out the cables several times and It showed up one time.  I just bought a new cable (24" rnd 80) and that hasn't helped. I have checked the power plugs to the devices and they have power.     I have set the drives from IDE - SATA - etc.   No go.  The DVD's jumper is set to Master and is at the end of the cable,  the HDD is set to Slave  on the middle of the cable. 
    Can't see a correlation but Boot.ini running in PAE mode.
    Could there be something wrong with the board or the BIOS?
    Twice I have done a hard shutdown and it has showed up.  But when I restart or shut it down for the night It won't show when it starts back up??   System Restore does nothing.
    On other old BIOS' I could hit a key to "detect" drives,  but this BIOS has no option for that.  Everything it "Auto".
    Any help would be appreciated

  • Problems with ImageIO.write()

    Well I am finding it very strange with ImageIO.write();
    Consider the following code snippet:
    BufferedImage img=ImageIO.read(new File("fw2.jpg"));
    BufferedImage img1=new BufferedImage(img.getWidth(),img.getHeight(),img.TYPE_INT_ARGB);
    for(int i=0;i<img.getHeight();i++)
    for(int j=0;j<img.getWidth();j++)
    img1.setRGB(j,i,img.getRGB(j,i));
    ImageIO.write(img1,"jpg",new File("fwinv.jpg"));
    So simply I am copying fw2.jpg to fwinv.jpg. fw2.jpg was also created
    using ImageIO.write().
    But the two files are having different pixel values.
    i.e If I read fwinv.jpg again I will get different pixel value that it was written.
    Why is this...Can any one please help me..

    Reading the written images back and displaying them in java works okay. The third image looks okay in RGB but wrong in ARGB when displayed by a native app. For more about this see reply 1 in Color problems and the linked bug report: Some Images written using JPEG Image Writer are not recognized by native applns.
    import java.awt.GridLayout;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    public class WriteTest {
        private JPanel getContent(BufferedImage src) throws IOException {
            File fileOne = new File("fileOne.jpg");
            ImageIO.write(src, "jpg", fileOne);
            BufferedImage image1 = ImageIO.read(fileOne);
            BufferedImage image2 = copy(image1);
            JPanel panel = new JPanel(new GridLayout(1,0));
            panel.add(new JLabel(new ImageIcon(src)));
            panel.add(new JLabel(new ImageIcon(image1)));
            panel.add(new JLabel(new ImageIcon(image2)));
            return panel;
        private BufferedImage copy(BufferedImage in) throws IOException {
            int w = in.getWidth();
            int h = in.getHeight();
            int type = BufferedImage.TYPE_INT_ARGB;   // problem in native apps
                       //BufferedImage.TYPE_INT_RGB;  // this one works okay
            BufferedImage out = new BufferedImage(w, h, type);
            for(int y = 0; y < h; y++) {
                for(int x = 0; x < w; x++) {
                    out.setRGB(x, y, in.getRGB(x, y));
            File fileTwo = new File("fileTwo.jpg");
            ImageIO.write(out, "jpg", fileTwo);
            return ImageIO.read(fileTwo);
        public static void main(String[] args) throws IOException {
            BufferedImage image = ImageIO.read(new File("images/cougar.jpg"));
            WriteTest test = new WriteTest();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(test.getContent(image));
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Problem with CD writer interaction!!!!

    Hi! I'm trying to write a program that will interact with any CD writer which means the program supposed to be capable of burning data on a CD. Is it possible to interact with CD writer in Java? If it is can anyone point me to a online resource where it is explained clearly or can anyone explain it to me in plain English?
    Thanks in advance.
    --DM777                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    To burn CD's, you have to interact with the CD-burner on a pretty low level (hardware level). Java doesn't support this by default.
    There may be 3rd-party libraries (probably based on JNI), which give you burner support, but I don't know of one.
    Cheers,
    --Arnout                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • A problem with JTextArea.write()

    hi, I'm writting some code about reading content of a TextArea by use the method JTextArea.write().
    when the content is short, that will be ok, but the content is too long, my thread seems to be dead. and NetBeans's debuger shows nothing, just unresponse.
    can someone to point out my problem in the code below?
    textSource.write(bfw); //textSource is extends from JTextArea, when content in it is too large, dead here
    private void output2textResult() {
            Runnable myThread = new Runnable() {
                public void run() {
                    // component.doSomething();
                    final String source = txtFldSource.getText();
                    final String destination= txtFldDestination.getText();
                    String tmp;
                    try{
                        PipedWriter pipOut = new PipedWriter();                  
                        BufferedWriter bfw = new BufferedWriter(pipOut);   //I wrapped the pipOut with the BufferedWrite
                        PipedReader pipIn = new PipedReader(pipOut);
                        BufferedReader bfr= new BufferedReader(pipIn);
    //problem line below
                        textSource.write(bfw);   //textSource is extends from JTextArea, when content in it is too large, dead here  
                        while(bfr.ready()){
                            tmp = bfr.readLine();
                            tmp.replaceAll(source, destination);
                            textResult.append(tmp+"\n");
                        bfr.close();
                        pipIn.close();
                        pipOut.close();
                    }catch(IOException e){
                        System.out.println(e);
            SwingUtilities.invokeLater(myThread);

    This won't work. Pipes are for use between threads. The implication of what you're doing in a single thread is that the pipe is somehow capable of holding the entire source text (which it isn't). In other words you're just trying to buffer it, so you may as well just get all the source text as a String and do your magic on it directly.

  • Problem with ImageIO.write

    Hello I am trying to write to file. Here is my code
        try
          File file = new File("C://images//queryX.gif");
        if (file.exists())
            {file.delete();}
          ImageIO.write(bi_new, "GIF", file);  // bi_new is my bufferedImage
        catch (IOException e)
          e.printStackTrace();
        }The file is being created but it is blank. The buffered image is fine because i am having it displayed to screen with an imageicon on a Jlabel.
    Any ideas why the file is blank?
    Cheers.

    The likely problem is that an encoder can not be found.
    First check the return value from the ImageIO.write() method. If it is false it means that an appropriate
    encoder could not be found. (This is quite likely as GIF encoders have some patenting problems and
    Im not sure if SUN has included a GIF encoder.
    Also it should not be necessary to delete the file if it already exists as the ImageIO.write method will
    overwrite it anyway.
    matfud

  • Problem with PDFBox-0.7.3 library - Runtime Error

    Hello,
    The problem is inside the method "chamaConversor".
    " conversor.pdfToText(arquivoPdf,arquivoTxt);" make a file.txt from one file.pdf. After that it don?t return the control to "ConstrutorDeTemplate2.java", and show the following error message:
    Exception in thread "AWT-EventQueue-O" java.lang.NoClassDefFoundError : org/fontbox/afm/FontMetric
    at org.pdfbox.pdmodel.font.PDFont.getAFM (PDFont.java:334)
    I am using the NetBeans IDE 5.5.
    I have added all of these libraries below to my project from c:\Program Files\netbeans-5.5\PDFBox-0.7.3\external:
    * FontBox-0.1.0-dev.jar
    * ant.jar
    * bcmail-jdk14-132.jar
    * junit.jar
    * bcprov-jdk14-132.jar
    * lucene-core-2.0.0.jar
    * checkstyle-all-4.2.jar
    * lucene-demos-2.0.0.jar
    and PDFBox-0.7.3.jar from c:\Program Files\netbeans-5.5\PDFBox-0.7.3\lib.
    There are no more jar from PDFBox-0.7.3 directory.
    All of these libraries are in "Compile-time Libraries" option in Project Properties. Should I add they to "Run-time Libraries" option?
    What is going on?
    Thank you!
      * ConstrutorDeTemplate2.java
      * Created on 11 de Agosto de 2007, 14:54
      * @author
    package br.unifacs.dis2007.template2;
    // Java core packages
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.text.*;
    import java.util.*;
    // Java extension packages
    import javax.swing.*;
    import org.pdfbox.*;
    public class ConstrutorDeTemplate2 extends JFrame
        implements ActionListener {
        private JTextField enterField;
        private JTextArea outputArea;
        private BufferedWriter out;
        private String word;
        private PdfToText conversor = new PdfToText();
        // ajusta a interface do usu?rio
        public ConstrutorDeTemplate2()
           super( "Testing class File" );
           enterField = new JTextField("Digite aqui o nome do arquivo :" );
           enterField.addActionListener( this );
           outputArea = new JTextArea();
           ScrollPane scrollPane = new ScrollPane();
           scrollPane.add( outputArea );
           Container container = getContentPane();
           container.add( enterField, BorderLayout.NORTH );
           container.add( scrollPane, BorderLayout.CENTER );
           setSize( 400, 400 );
           show();
        // Exibe as informa??es sobre o arquivo especificado pelo usu?rio
        public void actionPerformed( ActionEvent actionEvent )
           File name = new File( actionEvent.getActionCommand() );
           // Se o arquivo existe, envia para a sa?da as informa??es sobre ele
           if ( name.exists() ) {
              outputArea.setText(
                 name.getName() + " exists\n" +
                 ( name.isFile () ?
                    "is a file\n" : "is not a file\n" ) +
                 ( name.isDirectory() ?
                    "is a directory\n" : "is not a directory\n" ) +
                 ( name.isAbsolute() ? "is absolute path\n" :
                    "is not absolute path\n" ) +
                 "Last modified: " + name.lastModified() +
                 "\nLength: " + name.length () +
                 "\nPath: " + name.getPath() +
                 "\nAbsolute path: " + name.getAbsolutePath() +
                 "\nParent: " + name.getParent() );
              // informa??o de sa?da se "name" ? um arquivo
              if ( name.isFile() ) {
                 String nameString = String.valueOf(name.getPath());
                 String nameTeste = new String(nameString);
                 if (nameString.endsWith(".pdf"))
                     nameTeste = chamaConversor(nameString);
                 else
                     if (nameString.endsWith(".doc"))
                         nameTeste = chamaConversorDoc(nameString); // chama conversor de arquivos DOC
                     else
                         if (nameString.endsWith(".txt"))
                             nameTeste = nameString;
                 // se o arquivo termina com ".txt"           
                 if (nameTeste.endsWith(".txt"))
                     // acrescenta conte?do do arquivo ? ?rea de sa?da
                     try {
                         // Create the tokenizer to read from a file
                         FileReader rd = new FileReader(nameTeste);
                         StreamTokenizer st = new StreamTokenizer(rd);
                         // Prepare the tokenizer for Java-style tokenizing rules
                         st.parseNumbers();
                         st.wordChars('_', '_');
                         st.eolIsSignificant (true);
                         // If whitespace is not to be discarded, make this call
                         st.ordinaryChars(0, ' ');
                         // These calls caused comments to be discarded
                         st.slashSlashComments(true);
                         st.slashStarComments(true);
                         // Parse the file
                         int token = st.nextToken();
                         String word_ant = "";
                         outputArea.append( " \n" );
                         out = new BufferedWriter(new FileWriter(nameTeste, true));
                         while (token != StreamTokenizer.TT_EOF) {
                             token = st.nextToken();
                             if (token == StreamTokenizer.TT_EOL){
                                 //out.write(word);
                                 out.flush();
                                 out = new BufferedWriter(new FileWriter(nameTeste, true));
                                 //outputArea.append( word + "\n" );
                                 // out.append ( "\n" );
                             switch (token) {
                             case StreamTokenizer.TT_NUMBER:
                                 // A number was found; the value is in nval
                                 double num = st.nval;
                                 break;
                             case StreamTokenizer.TT_WORD:
                                 // A word was found; the value is in sval
                                 word = st.sval;
                                 //   if (word_ant.equals("a") || word_ant.equals("an") || word_ant.equals("the") || word_ant.equals("The") || word_ant.equals("An"))
                                 outputArea.append( word.toString() + " \n " );
                                // out.append( word + "   " );
                                 //     word_ant = word;
                                 break;
                             case '"':
                                 // A double-quoted string was found; sval contains the contents
                                 String dquoteVal = st.sval;
                                 break;
                             case '\'':
                                 // A single-quoted string was found; sval contains the contents
                                 String squoteVal = st.sval;
                                 break;
                             case StreamTokenizer.TT_EOL:
                                 // End of line character found
                                 break;
                             case StreamTokenizer.TT_EOF:
                                 // End of file has been reached
                                 break;
                             default:
                                 // A regular character was found; the value is the token itself
                                 char ch = (char)st.ttype;
                                 break;
                             } // fim do switch
                         } // fim do while
                         rd.close();
                         out.close();
                     } // fim do try
                     // process file processing problems
                     catch( IOException ioException ) {
                         JOptionPane.showMessageDialog( this,
                         "FILE ERROR",
                         "FILE ERROR", JOptionPane.ERROR_MESSAGE );
                 } // fim do if da linha 92 - testa se o arquivo ? do tipo texto
              } // fim do if da linha 78 - testa se ? um arquivo
              // output directory listing
              else if ( name.isDirectory() ) {
                     String directory[] = name.list();
                 outputArea.append( "\n\nDirectory contents:\n");
                 for ( int i = 0; i < directory.length; i++ )
                    outputArea.append( directory[ i ] + "\n" );
              } // fim do else if da linha 184 - testa se ? um diret?rio
           } // fim do if da linha 62 - testa se o arquivo existe
           // not file or directory, output error message
           else {
              JOptionPane.showMessageDialog( this,
                 actionEvent.getActionCommand() + " Does Not Exist",
                 "ERROR", JOptionPane.ERROR_MESSAGE );
        }  // fim do m?todo actionPerformed
        // m?todo que chama o conversor
        public String chamaConversor(String arquivoPdf){
            String arquivoTxt = new String(arquivoPdf);
            arquivoTxt = arquivoPdf.replace(".pdf", ".txt");
            try {
                conversor.pdfToText(arquivoPdf,arquivoTxt);
            catch (Exception ex) {
                ex.printStackTrace();
            return (arquivoTxt);
        // executa a aplica??o
        public static void main( String args[] )
           ConstrutorDeTemplate2 application = new ConstrutorDeTemplate2();
           application.setDefaultCloseOperation (
              JFrame.EXIT_ON_CLOSE );
        } // fim do m?todo main
    }  // fim da classe ExtratorDeSubstantivos2
      * PdfToText.java
      * Created on 11 de Agosto de 2007, 10:57
      * To change this template, choose Tools | Template Manager
      * and open the template in the editor.
    //package br.unifacs.dis2007.template2;
      * @author www
    package br.unifacs.dis2007.template2;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    import java.io.Writer;
    import java.net.MalformedURLException;
    import java.net.URL ;
    import org.pdfbox.pdmodel.PDDocument;
    import org.pdfbox.pdmodel.encryption.AccessPermission;
    import org.pdfbox.pdmodel.encryption.StandardDecryptionMaterial;
    import org.pdfbox.util.PDFText2HTML;
    import org.pdfbox.pdmodel.font.PDFont.* ;
    import org.pdfbox.util.PDFTextStripper;
    import org.pdfbox.util.*;
    import org.pdfbox.pdmodel.*;
    public class PdfToText
        public void pdfToText( String pdfFile, String textFile) throws Exception
                Writer output = null;
                PDDocument document = null;
                try
                    try
                        //basically try to load it from a url first and if the URL
                        //is not recognized then try to load it from the file system.
                        URL url = new URL( pdfFile );
                        document = PDDocument.load( url );
                        String fileName = url.getFile();
                        if( textFile == null && fileName.length () >4 )
                            File outputFile =
                                new File( fileName.substring( 0,fileName.length() -4 ) + ".txt" );
                            textFile = outputFile.getName();
                    catch( MalformedURLException e )
                        document = PDDocument.load( pdfFile );
                        if( textFile == null && pdfFile.length() >4 )
                            textFile = pdfFile.substring( 0,pdfFile.length() -4 ) + ".txt";
                       //use default encoding
                      output = new OutputStreamWriter( new FileOutputStream( textFile ) );
                    PDFTextStripper stripper = null;
                    stripper = new PDFTextStripper();
                    stripper.writeText( document, output );
                finally
                    if( output != null )
                        output.close();
                    if( document != null )
                        document.close();
                }//finally
            }//end funcao
     

    All of these libraries are in "Compile-time
    Libraries" option in Project Properties. Should I add
    they to "Run-time Libraries" option?Yes

  • Problem with Ribbon when multiple List / Library WebPart are added to the same page

    Hi,
    I'm working on a SharePoint 2013 custom branding (custom master page and layout).
    I added one page layout with several Web Part Zones,
    <div id="cBottomFirst" class="cThreeColumn cThreeColumndMargin" >
    <div data-name="WebPartZone">
    <!--CS: Start Web Part Zone Snippet-->
    <!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
    <div xmlns:ie="ie">
    <!--MS:<WebPartPages:WebPartZone runat="server" Title="Bottom Left Area" ID="wpz_bottom_left" AllowCustomization="True" AllowPersonalization="False" FrameType="TitleBarOnly" Orientation="Vertical">-->
    <!--MS:<ZoneTemplate>-->
    <!--DC: Replace this comment with default web parts for new pages. -->
    <!--ME:</ZoneTemplate>-->
    <!--ME:</WebPartPages:WebPartZone>-->
    </div>
    <!--CE: End Web Part Zone Snippet-->
    </div>
    </div>
    I have a problem, when I add several List View Web Part to the same page, then when I select one list / library, the ribbon is shown, but it is shown with all option disabled.
    Any idea?
    José Quinto Zamora SharePoint and Search Specialist MCITP and MCPD in SharePoint 2010
    http://joSharePoint.com

    Hi,
    According to your description, I suggest you check as follows:
    1. Please check that whether the ribbon is OK when you use the OOTB feature to add the web part to a page;
    2. What if you do the test in IE, will the issue still occur?
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

Maybe you are looking for