B4J Question [SOLVED] b4jPackager Issue - jdeps list not complete

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
I am trying to use the builtin packager. But I cannot get it to work properly.

I am using the latest version of B4j
I have downloaded the version of Java 11.0.1.


In Main I have -
B4X:
#AdditionalJar: sqlite-jdbc-3.7.2
#AdditionalJar: bcprov-jdk15on-161
#AdditionalJar: pdfbox-app-2.0.24.jar

#region Packager settings
'https://www.b4x.com/android/forum/threads/solved-b4jpackager11-error-javax-net-ssl-sslhandshakeexception.106141/
#PackagerProperty: IncludedModules = jdk.crypto.ec
'#PackagerProperty: IncludedModules = java.desktop

#PackagerProperty: IconFile = ../../SharedImages/appicon.ico
#PackagerProperty: ExeName = BCG Oral Health
#PackagerProperty: IncludedModules = javafx.web
#CustomBuildAction:  After Packager, %WINDIR%\System32\robocopy.exe, /MIR temp\build\ ../../PackagedOutput
#end region

#CustomBuildAction: 1, C:\Program Files\Java\jdk1.8.0_191\bin\java.exe, -jar C:\B4XBUILDS\compiletime.jar

The output is:

B4X:
B4JPackager11 Version 1.40
Exe name: BCG Oral Health.exe
build folder: E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\B4J\Objects\temp\build
InputJar: E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\B4J\Objects\b4x.jar
Running: E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\B4J\Objects\temp\FindDosPath.exe
Running: E:\Development\java\jdk-11.0.1\bin\jar
Package name: uk.co.digitwell.bcgoralhealth
Running: E:\Development\java\jdk-11.0.1\bin\jdeps
.
.
.
.
.
.
.
.
.
Explicitly excluded modules: [javafx.web]
Included modules: [jdk.crypto.ec, javafx.web, java.base]
Running: E:\Development\java\jdk-11.0.1\bin\javac
.
module-info.java:7: error: package javax.imageio.spi is not visible
uses javax.imageio.spi.ImageReaderSpi;
                  ^
  (package javax.imageio.spi is declared in module java.desktop, but module b4j does not read it)
1 error

Reading through some of the posts on the forum, it looks like my included modules is not complete. I tried to adding
#PackagerProperty: IncludedModules = java.desktop

which allowed it to compile but then the completed jar filecrashes with:
B4X:
E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\PackagedOutput\bin>java.exe @release_java_modules.txt  -m b4j/uk.co.digitwell.bcgoralhealth.main
keyvaluestore._initialize (java line: -1)
java.lang.NoClassDefFoundError: java/sql/Driver
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
        at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
        at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(Unknown Source)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Unknown Source)
        at b4j/anywheresoftware.b4j.objects.SQL.Initialize2(Unknown Source)
        at b4j/anywheresoftware.b4j.objects.SQL.Initialize(Unknown Source)
        at b4j/anywheresoftware.b4j.objects.SQL.InitializeSQLite(Unknown Source)
        at b4j/uk.co.digitwell.bcgoralhealth.keyvaluestore._initialize(Unknown Source)
        at b4j/uk.co.digitwell.bcgoralhealth.globals._createglobals(Unknown Source)
        at b4j/uk.co.digitwell.bcgoralhealth.b4xmainpage._initialize(Unknown Source)
        at b4j/uk.co.digitwell.bcgoralhealth.b4xpagesmanager._initialize(Unknown Source)
        at b4j/uk.co.digitwell.bcgoralhealth.main._appstart(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.raiseEvent(Unknown Source)
        at b4j/uk.co.digitwell.bcgoralhealth.main.start(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(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.ClassNotFoundException: java.sql.Driver
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        ... 36 more

Any idea what I am doing wrong?
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Thanks for looking but the same issues occur

B4X:
B4JPackager11 Version 1.40
Exe name: BCG Oral Health.exe
build folder: E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\B4J\Objects\temp\build
InputJar: E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\B4J\Objects\b4x.jar
Running: E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\B4J\Objects\temp\FindDosPath.exe
Running: E:\Development\java\jdk-14.0.1\bin\jar
.
Package name: uk.co.digitwell.bcgoralhealth
Running: E:\Development\java\jdk-14.0.1\bin\jdeps
.
.
.
.
.
.
.
.
Explicitly excluded modules: [javafx.web]
Included modules: [jdk.crypto.ec, javafx.web, java.base]
Running: E:\Development\java\jdk-14.0.1\bin\javac
module-info.java:7: error: package javax.imageio.spi is not visible
uses javax.imageio.spi.ImageReaderSpi;
                  ^
  (package javax.imageio.spi is declared in module java.desktop, but module b4j does not read it)
1 error

I did spot this link which refers to using PDFBox


so have now included #CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, /e ..\pdfbox temp\build\bin\

It doesn't help the current problem but may solve a later one.

As far as I can tell, it seems to be something to do with the Included modules, my list is a lot shorter than the one in Erel's animated GIF
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Ok, after a lot of messing about with the standalone source version of the packager. I have found the problem.

It seems that the version of bouncy castle I have been using is in some way corrupt.

#AdditionalJar: bcprov-jdk15on-161

Switching to the latest version, #AdditionalJar: bcprov-jdk15on-169

seemed to allow jdeps to run correctly and the Packager to produce a longer set of module.
B4X:
B4JPackager11 Version 1.40
Exe name: BCG Oral Health.exe
build folder: E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\B4J\Objects\temp\build
InputJar: E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\B4J\Objects\b4x.jar
Running: E:\Development\AppSales\Bedfordshirecaregroup\bcgoralhealth\b4x\B4J\Objects\temp\FindDosPath.exe
.
Running: E:\Development\java\jdk-14.0.1\bin\jar
Package name: uk.co.digitwell.bcgoralhealth
Running: E:\Development\java\jdk-14.0.1\bin\jdeps
.
.
.
.
.
.
.
.
Explicitly excluded modules: [javafx.web]
Included modules: [jdk.crypto.ec, javafx.web, java.base, java.datatransfer, java.desktop, java.logging, java.naming, java.prefs, java.sql, java.xml, javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing]
Running: E:\Development\java\jdk-14.0.1\bin\javac
.
Running: E:\Development\java\jdk-14.0.1\bin\jar
.
.
.
Running: E:\Development\java\jdk-14.0.1\bin\jlink
.
.
.
.
.
.
.
.
.
.
.
.
Running: C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\csc.exe
Running: explorer.exe
Done!



The packaged app now runs.
 
Upvote 0
Top