Hi Everyone, I have been trying to find a way to make a project distributable for a couple of months, I am able to create an .exe file using the B4JPackager tool and Inno Setup, but for some reason I get some errors that I do not get when I run the project from within B4J, here's the thread for more context.
@Erel suggested I distribute the jar file along with OpenJDK and a batch file to launch the jar file, I have created the following batch file
That batch file actually launches the Jar file, but I get this error right away and then the jar file closes.
I have added these two lines to the project in hopes of fixing this issue, but doesn't work.
Does anyone know what else I can try, It is frustrating that it is so difficult to find a solution that can finally allow me to distribute this file, it is very trivial as I am on a deadline here at work, maybe I should have done this using a different platform, but lesson learned, as I have no more time I need to find a solution.
Thanks everyone
Walter
@Erel suggested I distribute the jar file along with OpenJDK and a batch file to launch the jar file, I have created the following batch file
batch file:
@ECHO OFF
TITLE RUN A JAR FILE
CD C:\Java\jdk-14.0.1\bin
javaw --module-path C:\Java\jdk-14.0.1\javafx\lib --add-modules ALL-MODULE-PATH -jar "C:\Users\wflores\Documents\B4J_Projects\WindowsCompanion\B4J\Objects\WindowsCompanion.jar"
::PAUSE
That batch file actually launches the Jar file, but I get this error right away and then the jar file closes.
b4xmainpage$ResumableSub_B4XPage_Created.resume (java line: -1)
java.lang.RuntimeException: java.lang.IllegalAccessError: class anywheresoftware.b4a.objects.B4XCanvas$B4XPath (in module b4j) cannot access class com.sun.javafx.geom.Path2D (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.geom to module b4j
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4j.objects.CustomViewWrapper.AfterDesignerScript(Unknown Source)
at b4j/anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(Unknown Source)
at b4j/anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(Unknown Source)
at b4j/anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(Unknown Source)
at b4j/com.snap.companion.b4xmainpage$ResumableSub_B4XPage_Created.resume(Unknown Source)
at b4j/anywheresoftware.b4a.BA.checkAndRunWaitForEvent(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent(Unknown Source)
at b4j/anywheresoftware.b4a.keywords.Common$3.run(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
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.IllegalAccessError: class anywheresoftware.b4a.objects.B4XCanvas$B4XPath (in module b4j) cannot access class com.sun.javafx.geom.Path2D (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.geom to module b4j
at b4j/anywheresoftware.b4a.objects.B4XCanvas$B4XPath.InitializeRoundedRect(Unknown Source)
at b4j/com.snap.companion.jpanel._buildgradients(Unknown Source)
at b4j/com.snap.companion.jpanel._designercreateview(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)
... 17 more
I have added these two lines to the project in hopes of fixing this issue, but doesn't work.
Added Lines:
#VirtualMachineArgs: --add-opens javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED
#VirtualMachineArgs: --add-exports javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED
Does anyone know what else I can try, It is frustrating that it is so difficult to find a solution that can finally allow me to distribute this file, it is very trivial as I am on a deadline here at work, maybe I should have done this using a different platform, but lesson learned, as I have no more time I need to find a solution.
Thanks everyone
Walter
Last edited: