B4J Question [Solved] B4JPackager11 creates a 36KB run.exe file which doesn't run?

mark35at

Well-Known Member
Licensed User
I have written a small UI-App to decode ICG files and need to distribute the .exe file. I am using:

Win 10 64 bit
B4J 7.31
Java jdk 11.0.1

I have added the paths as required:

B4X:
'Non-UI application (console / server application)
#Region Project Attributes
    #CommandLineArgs:
    #MergeLibraries: True
#End Region

Sub Process_Globals
    Private InputJar As String = "d:\temp\IGC2Excel.jar" 'change as needed
    Private NetFrameworkCSC As String = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe" 'windows only
    Private IconFile As String= "d:\temp\IGC.ico"
    Private ExcludedModules As List
    ExcludedModules = Array("javafx.web") 'comment this line if using WebView
    Private IncludedModules As List
    Private AdditionalModuleInfoString As String '= "uses org.eclipse.jetty.websocket.common.RemoteEndpointFactory;"
    Private VMArgs As String
    'non configurable variables:
    Private JavafxJmods As String
    Private java As String
    Private PackageName As String
    Private TempFolder As String
    Private Modules As List
    Private TargetModule As String = "b4j"
    Private JavaFXLibs As String
    Private Version As Float = 1.13
    Private Windows As Boolean
    Private Mac As Boolean
    Private Linux As Boolean 'ignore
End Sub
The packager is version 1.13 and runs without error but the run.exe will not execute - no error. What have I missed?

Log:
B4JPackager11 Version 1.13
InputJar: d:\temp\IGC2Excel.jar
Running: D:\Basic4Java\Examples\B4JPackager11\B4JPackager11\Objects\temp\FindDosPath.exe
Running: C:\java\jdk-11.0.1\bin\jar
Package name: b4j.example
Running: C:\java\jdk-11.0.1\bin\jdeps
.
.
.
.
.
.
Explicitly excluded modules: [javafx.web]
Included modules: [java.base, java.desktop, java.logging, java.security.jgss, java.xml, java.xml.crypto, javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, jdk.javadoc, java.scripting, jdk.unsupported, java.datatransfer, jdk.unsupported.desktop, jdk.jsobject, jdk.xml.dom]
Running: C:\java\jdk-11.0.1\bin\javac
.
Running: C:\java\jdk-11.0.1\bin\jar
.
Running: C:\java\jdk-11.0.1\bin\jlink
.
.
.
.
.
.
.
.
.
Running: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe
Running: explorer.exe
 

mark35at

Well-Known Member
Licensed User
Aha. So i have tried to run the run.exe in its original folder (B4JPackager11/Objects/temp/build).

upload_2019-9-5_13-52-19.png



It runs but then just closes during execution. My app works alone in debug and release mode without errors or problems.

The executable will not run without all the files in the subfolders.
Would it be enough to zip the contents of /build and distribute?
 

mark35at

Well-Known Member
Licensed User
D:\Basic4Java\Examples\B4JPackager11\B4JPackager11\Objects\temp\build>cd bin

D:\Basic4Java\Examples\B4JPackager11\B4JPackager11\Objects\temp\build\bin>java.exe @release_java_modules.txt -m b4j/b4j.example.main
4089
B0905574733598N01505176EA0173901839
B1013574732021N01504451EA0073200774
9530
B1251374730241N01519151EA0109201154
B1530304729076N01519790EA0056600602
Diagnostic XML Bean debug log file created: c:\temp\xmlbeandebug17803086152612257123.log
main._senddatatoexcel (java line: -1)
java.lang.ExceptionInInitializerError
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unknown Source)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unknown Source)
at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(Unknown Source)
at java.base/java.lang.reflect.Field.acquireFieldAccessor(Unknown Source)
at java.base/java.lang.reflect.Field.getFieldAccessor(Unknown Source)
at java.base/java.lang.reflect.Field.get(Unknown Source)
at b4j/org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(Unknown Source)
at b4j/org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook.<clinit>(Unknown Source)
at b4j/org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook$Factory.newInstance(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/anywheresoftware.b4j.objects.PoiWorkbookWrapper.InitializeNew(Unknown Source)
at b4j/b4j.example.main._senddatatoexcel(Unknown Source)
at b4j/b4j.example.main._btnconvert_click(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.BA$1.run(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Could not instantiate SchemaTypeSystemImpl (java.lang.reflect.InvocationTargetException): is the version of xbean.jar correct?
at b4j/schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443.TypeSystemHolder.loadTypeSystem(Unknown Source)
at b4j/schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443.TypeSystemHolder.<clinit>(Unknown Source)
... 35 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
... 37 more
Caused by: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sD023D6490046BA0250A839A9AD24C443/index.xsb (schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443.index) - code 0
at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(Unknown Source)
at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(Unknown Source)
at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source)
... 41 more


D:\Basic4Java\Examples\B4JPackager11\B4JPackager11\Objects\temp\build\bin>pause
Drücken Sie eine beliebige Taste . . .

Now I am lost, does this help?
 

mark35at

Well-Known Member
Licensed User
xmlbeandebug17803086152612257123.log:

XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sD023D6490046BA0250A839A9AD24C443/index.xsb (schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443.index) - code 0
org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sD023D6490046BA0250A839A9AD24C443/index.xsb (schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443.index) - code 0
at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(Unknown Source)
at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(Unknown Source)
at b4j/org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(Unknown Source)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at b4j/schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443.TypeSystemHolder.loadTypeSystem(Unknown Source)
at b4j/schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443.TypeSystemHolder.<clinit>(Unknown Source)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unknown Source)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unknown Source)
at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(Unknown Source)
at java.base/java.lang.reflect.Field.acquireFieldAccessor(Unknown Source)
at java.base/java.lang.reflect.Field.getFieldAccessor(Unknown Source)
at java.base/java.lang.reflect.Field.get(Unknown Source)
at b4j/org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(Unknown Source)
at b4j/org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook.<clinit>(Unknown Source)
at b4j/org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook$Factory.newInstance(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(Unknown Source)
at b4j/anywheresoftware.b4j.objects.PoiWorkbookWrapper.InitializeNew(Unknown Source)
at b4j/b4j.example.main._senddatatoexcel(Unknown Source)
at b4j/b4j.example.main._btnconvert_click(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.BA$1.run(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
 

mark35at

Well-Known Member
Licensed User
I made these changes to B4JPacker11 (based on the post here)

B4X:
Sub Process_Globals
    Private InputJar As String = "d:\temp\IGC2Excel.jar" 'change as needed
    Private NetFrameworkCSC As String = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe" 'windows only
    Private IconFile As String= "d:\temp\IGC.ico"
    Private ExcludedModules As List 
    ExcludedModules = Array("javafx.web") 'comment this line if using WebView
    Private IncludedModules As List
        IncludedModules = Array("jdk.charsets")
        'Private AdditionalModuleInfoString As String '= "uses org.eclipse.jetty.websocket.common.RemoteEndpointFactory;"
        Private AdditionalModuleInfoString As String ="opens schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443;"
    Private VMArgs As String
    'non configurable variables:
    Private JavafxJmods As String
    Private java As String
    Private PackageName As String
    Private TempFolder As String
    Private Modules As List
    Private TargetModule As String = "b4j"
    Private JavaFXLibs As String
    Private Version As Float = 1.13
    Private Windows As Boolean
    Private Mac As Boolean 
    Private Linux As Boolean 'ignore
End Sub
Thank you Erel, was just writing the post when your answer came.

Checking now ....
 

mark35at

Well-Known Member
Licensed User
Works fine now. Thanks Erel.
 
Top