B4J Question [ABMaterial] GridBuilder and Java11

janderkan

Active Member
Licensed User
On Java 11 it is not possible to run a .jar file .
I tried pack it with B4JPackager11 but I only get a blank window.
This is the output from run_debug.bat
B4X:
C:\2Work\1C\B4J\B4JPackager11\Objects\temp\build\bin>java.exe @release_java_modules.txt -m b4j/com.ab.main
java.lang.NullPointerException
        at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.initCanvas(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.renderForClip(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.renderRectClip(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.renderClip(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.CacheFilter.renderNodeToCache(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.CacheFilter.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.renderCached(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.ViewPainter.doPaint(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.ViewPainter.paintImpl(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.PresentingPainter.run(Unknown Source)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.RenderJob.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
        at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.initCanvas(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.renderForClip(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.renderRectClip(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.renderClip(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.CacheFilter.renderNodeToCache(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.CacheFilter.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.renderCached(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.ViewPainter.doPaint(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.ViewPainter.paintImpl(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.PresentingPainter.run(Unknown Source)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.RenderJob.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
        at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.initCanvas(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.renderForcedContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderForcedContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderForcedContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderForcedContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderForcedContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderForcedContent(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.ViewPainter.paintImpl(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.PresentingPainter.run(Unknown Source)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.RenderJob.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
 

Erel

Administrator
Staff member
Licensed User
Is the source code available? Does it work when running from the IDE?
 

alwaysbusy

Expert
Licensed User
Here is the source code. It does use a custom library I wrote (ABCanvas) but for the moment I don't seem to be able to locate the source code for this library. I will have to dive into my backups of 2016.
 

Attachments

Erel

Administrator
Staff member
Licensed User
Does it work if you remove this line:
#VirtualMachineArgs: -Dprism.order=sw
?
 

Erel

Administrator
Staff member
Licensed User
This is the problem. You need to modify B4JPackager 11 and add it here:
Line 281:
B4X:
p.StartInfo.Arguments = "@release_java_modules.txt -Dprism.order=sw -m ${TargetModule}/${PackageName}.main";
 

OliverA

Expert
Licensed User
This is the problem. You need to modify B4JPackager 11 and add it here:
In my case, in order for run_debug to work I also change line 297 to
B4X:
java.exe @release_java_modules.txt -Dprism.order=sw -m ${TargetModule}/${PackageName}.main
Does this need to a future option for B4JPackager where you can select if JavaFX should use the graphics card or not? Or enable additional command line arguments?
 

janderkan

Active Member
Licensed User
The relevant line is 283 and it was changed:

Please look at post #9
B4X:
p.StartInfo.Arguments = "@release_java_modules.txt -Dprism.order=sw -m ${TargetModule}/${PackageName}.main";
In release 1.13 Run does not work, Run_debug works.
Adding both line 281 and 297 , Run and Run_debug works.
 
Last edited:

OliverA

Expert
Licensed User
Please look at post #9
I've tested the new version of B4JPackager (v 1.13) and it works correctly for this case. The only thing you have to add manually to run_debug.bat is the -dark command line parameter (if you want dark mode - which seems to be the preferred mode for ABMGruidBuilder). For run.exe, use it with the -dark command line argument. Alternative would be again to change B4JPackager's code to include -dark command line option (in the same places (with new line numbers) as this fix). Either that, or @Erel produces another B4JPackager11 that allows for command line arguments.
 

janderkan

Active Member
Licensed User
I've tested the new version of B4JPackager (v 1.13) and it works correctly for this case. The only thing you have to add manually to run_debug.bat is the -dark command line parameter (if you want dark mode - which seems to be the preferred mode for ABMGruidBuilder). For run.exe, use it with the -dark command line argument. Alternative would be again to change B4JPackager's code to include -dark command line option (in the same places (with new line numbers) as this fix). Either that, or @Erel produces another B4JPackager11 that allows for command line arguments.
I used v 1.12 and I got the error i post #1
I changed line 281 and 297 and it worked great.
With v1.13 I am back to the same error.
 

OliverA

Expert
Licensed User
Did you change the VMArgs global variable (in B4JPackager11) to:
B4X:
Private VMArgs As String = "-Dprism.order=sw"
 

janderkan

Active Member
Licensed User
Did you change the VMArgs global variable (in B4JPackager11) to:
B4X:
Private VMArgs As String = "-Dprism.order=sw"
This is new info, you cannot find it in this thread.
This is the code from v1.13
B4X:
   Private VMArgs As String
So if you run from IDE it does not work, no command line arguments.

Adding your change it works fine.
 
Top