Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Candy McCall on October 26, 2018, 02:05:58 AM

Title: Apache POI framework 3.17 version
Post by: Candy McCall on October 26, 2018, 02:05:58 AM
Has anyone tried the Apache POI framework 3.17 version? Reuben, have you tried it?   I see that you are using a 3.10 version on github.   I want it to run with Java 7 so I downloaded the latest available  which is 3.17.

I've just started trying to get it to work.
I have a simple program.  I'm just trying to get the 4GL to find the classes.
Code (genero) Select

IMPORT JAVA org.apache.poi.xssf.usermodel.XSSFWorkbook

MAIN

        DISPLAY "Hello world"

END MAIN



When I compile, I get this:
Code (genero) Select

IMPORT JAVA org.apache.poi.xssf.usermodel.XSSFWorkbook
| The symbol 'org.apache.poi.xssf.usermodel.XSSFWorkbook' does not represent a valid variable type.
| See error number -6622.

MAIN

        DISPLAY "Hello world"

END MAIN



My CLASSPATH:
Code (bash) Select

.:/users/genero/3.10.15/dev/lib/fgl.jar:/users/apache_poi/poi-3.17/poi-3.17.jar:/users/apache_poi/poi-3.17/poi-ooxml-3.17.jar:/users/apache_poi/poi-3.17/poi-ooxml-schemas-3.17.jar:/users/apache_poi/poi-3.17/ooxml-lib/xmlbeans-2.6.0.jar



Now I can compile this java program just fine:
Code (java) Select

import org.apache.poi.xssf.usermodel.XSSFWorkbook;
class Hello {
        public static void main(String[] args) {
                System.out.println("Hello");
        }
}



And I'm sure I have the right jar file:
Code (bash) Select

$ jar tf poi-ooxml-3.17.jar |grep XSSFWorkbook
Picked up JAVA_TOOL_OPTIONS: -Xss2m
org/apache/poi/poifs/crypt/temp/SXSSFWorkbookWithCustomZipEntrySource.class
org/apache/poi/xssf/streaming/SXSSFWorkbook$SheetIterator.class
org/apache/poi/xssf/streaming/SXSSFWorkbook.class
org/apache/poi/xssf/usermodel/XSSFWorkbook$1.class
org/apache/poi/xssf/usermodel/XSSFWorkbook$SheetIterator.class
org/apache/poi/xssf/usermodel/XSSFWorkbook.class
org/apache/poi/xssf/usermodel/XSSFWorkbookType.class



If I use the HSSFWorkbook, it compiles fine.

We are using Centos 7.3.   Also, we had to set  export JAVA_TOOL_OPTIONS=-Xss2m  as there is a problem in Centos 7.3.

Are there only certain versions that work?

Thanks!
Candy

Title: Re: Apache POI framework 3.17 version
Post by: Candy McCall on October 26, 2018, 08:10:02 PM
I got it to work.   It needed these jar files in the CLASSPATH:

Code (bash) Select

$FGLDIR/lib/fgl.jar
$POI_HOME/poi-3.17.jar
$POI_HOME/poi-ooxml-3.17.jar
$POI_HOME/poi-ooxml-schemas-3.17.jar
$POI_HOME/ooxml-lib/xmlbeans-2.6.0.jar
$POI_HOME/lib/commons-collections4-4.1.jar

I guess you could include all jar files in the CLASSPATH but I wanted the minimum.   Probably that can be figured out by looking at documentation of the classes and see its dependencies as well.

Candy