B4J Question PROBLEM WITH JPOI

Giacomo

Active Member
Licensed User
Longtime User
Ciao to all
My problem is the following:
If my app open a file of xlxs in debug mode everything works correctly but i have some warning the log ( javac.exe 11.0.1)
Waiting for debugger to connect...
Program started.
CreateTable: CREATE TABLE IF NOT EXISTS [Parti] ([Codice] TEXT, [Descrizione] TEXT, [NU/NC] TEXT, [Tipo] TEXT, [Picture] TEXT, [Returnable] TEXT, [Note] TEXT, [Prezzo] REAL, [Strumento] TEXT)
C:\Magazzino\Versione 03\Objects\Immagini\LIAISONXL_SpareParts_0119.xlsx
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.poi.util.DocumentHelper (file:/C:/Program%20Files%20(x86)/Anywhere%20Software/B4J/Libraries/poi-ooxml-3.12-20150511.jar) to method com.sun.org.apache.xerces.internal.util.SecurityManager.setEntityExpansionLimit(int)
WARNING: Please consider reporting this to the maintainers of org.apache.poi.util.DocumentHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
If i try to execute result.jar ( after having completed in release mode )
my jar file freezes the moment it opens the excel file

I try to compile with javac.exe 1.8.0_241 (in this case no warning but same problem)
and javac.exe 11.0.1

My application:
Sub Class_Globals
    Private fx As JFX
    Public Importa As Form
    Private BTN_Next As Button
    Private BTN_Cancell As Button
    Private BTN_Sel_File As Button
    Private FC As FileChooser
    Private TXT_File_da_importare As TextField
    Private UnZL As SD_ZipLibray
    Private LBL_Info_zip As Label
    Private LBL_Avviso As Label
    Private Tab_Zip As TabPage
    Private Tab_Excel_DB As TabPage
    Private Tab_plane_importa As TabPane
    Private List_View_excel As ListView
    Private BTN_Convert As Button
    Private File_excel_sel As String
    Private Leggi As PoiWorkbook
    Private Prog_Rotonda As ProgressIndicator
    Private LBL_Verifica As Label
End Sub

Sub BTN_Convert_Click
    File_excel_sel=File.DirApp & "\Immagini\" & File_excel_sel
    Log(File_excel_sel)
    'Leggi.InitializeExistingAsync("Lettura","",File_excel_sel,"")
    Leggi.InitializeExisting(File_excel_sel,"","")
    LBL_Verifica.Text="FATTO"
    LBL_Verifica.Text=LBL_Verifica.Text & " "& Leggi.IsInitialized
End Sub

Sub Lettura_Ready (Success As Boolean)
    Log("ho letto")
    Prog_Rotonda.Visible=False
    'Conversione_2
    Leggi.Close
End Sub

i try Leggi.InitializeExistingAsync("Lettura","",File_excel_sel,"")
and Leggi.InitializeExisting(File_excel_sel,"","")

same problem
Where am I wrong?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Giacomo

Active Member
Licensed User
Longtime User
When the app freeze... How big is your xlsx?
the app freezes when it has finished initializing the excell file in release mode
my xlsx is about 4Mb
Can you upload a testproject which shows the issue?

I have prepared a version that points directly to the screen that creates the problem
select the .xlsx file from the list and press 'Convert'
if the process ends the label writes "Read True"


or

 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
(today you scolded me twice 😔)
Sorry...

I haven't ran your project, however I see a possible reason for the issue.
This line only affects the app while it runs from the IDE:
B4X:
#VirtualMachineArgs: -Xms1024m -Xmx1024m

Try to run the jar file from the command line with: java -Xms1024m -Xmx1024m -jar result.jar
 
Upvote 0

Giacomo

Active Member
Licensed User
Longtime User
No problem You are right ☺
Try to run the jar file from the command line with: java -Xms1024m -Xmx1024m -jar result.jar

I have the same problem ..... 🤬
I tried to convert, with Excel; the file from XLSX to XLS (97-2003)
and the problem is disappeared
it's possible that the problem was due to hidden / protected columns or sheets (I know they are in my file) ?
at this point i was thinking of converting my files to XLS
!!!!!!!!!!!!!!!!!! WARNING: All illegal access operations will be denied in a future release !!!!!!!!!!!!!!!!
another question.
is it better to continue with JPOI or JExcel?
i use jpoi just to read the file then I convert the data to DB
 
Upvote 0
Top