B4J Question [Solved] jGoogleMaps Library V2.00 Example with Stand alone package fails

aminoacid

Active Member
Licensed User
Longtime User
I am trying out the JGoogleMaps library V2.00 example shown here:


I followed ALL the instructions very carefully (Steps 1, 2 and 3) and the Application works wonderfully in debug and release mode but only in the IDE.

Howver, when I build the standalone package, I get the following error message and a blank map:


B4X:
C:\Users\User\Documents\B4J\GoogleMaps\Objects\temp\build\bin>java.exe @release_java_modules.txt  -m b4j/b4j.google.map.main
Alert: Hide directions called
netscape.javascript.JSException: ReferenceError: Can't find variable: google
        at javafx.web/com.sun.webkit.dom.JSObject.fwkMakeException(Unknown Source)
        at javafx.web/com.sun.webkit.WebPage.twkExecuteScript(Native Method)
        at javafx.web/com.sun.webkit.WebPage.executeScript(Unknown Source)
        at javafx.web/javafx.scene.web.WebEngine.executeScript(Unknown Source)
        at b4j/com.lynden.gmapsfx.javascript.JavaFxWebEngine.executeScript(Unknown Source)
        at b4j/com.lynden.gmapsfx.GoogleMapView.initialiseScript(Unknown Source)
        at b4j/com.lynden.gmapsfx.GoogleMapView.access$1(Unknown Source)
        at b4j/com.lynden.gmapsfx.GoogleMapView$3.changed(Unknown Source)
        at b4j/com.lynden.gmapsfx.GoogleMapView$3.changed(Unknown Source)
        at javafx.base/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Unknown Source)
        at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
        at javafx.base/javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(Unknown Source)
        at javafx.base/javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(Unknown Source)
        at javafx.base/javafx.beans.property.ObjectPropertyBase.markInvalid(Unknown Source)
        at javafx.base/javafx.beans.property.ObjectPropertyBase.set(Unknown Source)
        at javafx.web/javafx.scene.web.WebEngine$LoadWorker.updateState(Unknown Source)
        at javafx.web/javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(Unknown Source)
        at javafx.web/javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(Unknown Source)
        at javafx.web/com.sun.webkit.WebPage.fireLoadEvent(Unknown Source)
        at javafx.web/com.sun.webkit.WebPage.fwkFireLoadEvent(Unknown Source)
        at javafx.web/com.sun.webkit.Timer.twkFireTimerEvent(Native Method)
        at javafx.web/com.sun.webkit.Timer.fireTimerEvent(Unknown Source)
        at javafx.web/com.sun.webkit.Timer.notifyTick(Unknown Source)
        at javafx.web/javafx.scene.web.WebEngine$PulseTimer.lambda$static$0(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)

I see on the forum that others have seen the same error message but not in the same context so their solutions don't seem to apply.

Any ideas as to why this is happening?

Thanks!
 
Solution
Yes. Confirmed! That was it. I installed B4J v9.80 and the standalone package worked right away without any issues.
As mentioned above, the jGoogleMaps library v2.00 appears to also work with Java 8 and (just tried) Java 11.

aminoacid

Active Member
Licensed User
Longtime User
Works fine here.
I've updated the example with the steps from the tutorial.

Make sure to use latest version of B4J.

Aah... that must be it. I am still using B4J V9.30 (I had not updated because of issues with jServer 4 and some existing apps).

BTW ... Since I could not get it to work with OpenJDK19, I reverted to Java 8 just to see if it did. The example works fine with Java8. I can run and compile it to a stand-alone JAR and have not had any issues even with an application that I wrote based on this example. Is there any reason *not* to use Java 8 ?
 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User
Yes. Confirmed! That was it. I installed B4J v9.80 and the standalone package worked right away without any issues.
As mentioned above, the jGoogleMaps library v2.00 appears to also work with Java 8 and (just tried) Java 11.
 
Upvote 0
Solution
Top