B4J Question module javafx.base does not export com.sun.javafx.collections

Arnaud

Active Member
Licensed User
Longtime User
Hello,

I try to run a app (project .jar )in Mac but I have few difficult and need help please. When I use the B4J-BRIDGE on the Mac and I connect it at B4J on my Windows PC, all works fine, in Debug mode and Release mode.

I would like test now the project.jar directly on the Mac, so:

1- I generate a standalone application with my Windows PC
2- I copy the project.jar on the mac
3- I run this on the Mac with the command java -jar project.jar.
4- I got htis message :

error:
java.lang.IllegalAccessException: class anywheresoftware.b4j.object.JavaObject cannot access class com.sun.javafx.collections.ObservableListWrapper (in module javafx.base) because module javafx.base does not export com.sun.javafx.collections to unnamed module @5a739047

I think I need to add something like this but not sure :
header1:
#VirtualMachineArgs: --add-exports javafx.base/com.sun.javafx.collections=ALL-UNNAMED

Here the header of my project, I have done a mistake somewhere or forgot something but I Don't know where:
Header2:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

#PackagerProperty: IncludedModules = jdk.charsets, javafx.web
'#PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx.javascript.event; opens schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443;
'#PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx.javascript.event;
 
#PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx;                         exports com.lynden.gmapsfx.javascript;                exports com.lynden.gmapsfx.javascript.event;
#PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx.javascript.object;    exports com.lynden.gmapsfx.service.directions;        exports com.lynden.gmapsfx.service.elevation;   
#PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx.service.geocoding;    exports com.lynden.gmapsfx.shapes;                   exports com.lynden.gmapsfx.zoom;

#VirtualMachineArgs: --add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
#VirtualMachineArgs: --add-exports javafx.base/com.sun.javafx.collections=ALL-UNNAMED



#VirtualMachineArgs: -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8
#PackagerProperty: VMArgs = -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8



#PackagerProperty: IconFile = ..\icon.ico
#PackagerProperty: ExeName = run.exe
#CustomBuildAction: After Packager, C:\Program Files (x86)\Inno Setup 6\Compil32.exe, /cc ..\InstallerScript.iss
#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ jssc.dll

Thanks for your help.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Don't create a standalone project on your Windows machine. It will not help for this case.

If you want to build a standalone Mac package then you need an Apple developer account (costs $99 per year) and follow these steps: https://www.b4x.com/android/forum/threads/macsigner-building-notarized-mac-packages.130890/#content

If you don't have a developer account then you can still create a package and then run it with the run.command bash script that will be created. You might encounter issues with the Mac blocking the unsigned Java runtime.

If you are adventurous, you can use the run.command file with B4J-Bridge Java. You just need to point to the correct paths.
 
Upvote 0
Top