Hi Erel,
I'm not an expert in Java or B4J, but before writing to you have tried any possible combination of test, reading back and forth from the forum.
I'm facing a problem using the WebView in a very simple UI application.
I've seen that JavaFX is no more supported, but this mean that B4J never ever can support UI applications?
All I want to just test (if possible, then) is to put a WebView into a Form, and load a page.
But seems it is impossible to get this result.
I'm using Raspberry using NOOBS.
I've installed JAVA using this file from Oracle: jdk-8-linux-arm-vfp-hflt.tar.gz
I've also installed the JavaFX from this file: openjfx-8-sdk-overlay-linux-armv6hf.zip
I've installed JAVA into the folder /home/pi/jdk1.8.0
I've also installed different version of JAVA from: jdk-8u60-linux-arm32-vfp-hflt.tar.gz
and installed the JavaFX from this file: openjfx-8u60-sdk-overlay-linux-armv6hf.zip
I've installed JAVA into the folder /home/pi/jdk1.8.0_60
Both the "openjfx" files was expanded into the respective folders (jdk1.8.0 and jdk1.8.0_60)
If I set the system to use the jdk from the jdk1.8.0 folder, I get this result:
java.lang.ClassNotFoundException: com.sun.glass.ui.monocle.MonoclePlatformFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:45)
at com.sun.glass.ui.Application.run(Application.java:145)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:279)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:216)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:653)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:314)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Failed to load Glass factory class
Exception in thread "main"
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at com.sun.glass.ui.Application.run(Application.java:145)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:279)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:216)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:653)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:314)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
... 5 more
If I set the system to use the jdk from jdk1.8.0_60 I get this result:
Waiting for debugger to connect...
Program started.
Java HotSpot(TM) Client VM warning: You have loaded library /home/pi/jdk1.8.0_60/jre/lib/arm/libjfxwebkit.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.DynamicBuilder.build(DynamicBuilder.java:16)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:116)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:166)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:78)
at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:81)
at b4j.example.main._appstart(main.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:612)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at b4j.example.main.start(main.java:36)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.s
un.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at anywheresoftware.b4j.objects.NodeWrapper.buildNativeView(NodeWrapper.java:664)
at anywheresoftware.b4j.objects.WebViewWrapper.build(WebViewWrapper.java:92)
... 33 more
Caused by: java.lang.Unsatisf
iedLinkError: /home/pi/jdk1.8.0_60/jre/lib/arm/libjfxwebkit.so: /home/pi/jdk1.8.0_60/jre/lib/arm/libjfxwebkit.so: classe ELF errata: ELFCLASS64 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:201)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:94)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:39)
at com.sun.webkit.WebPage.lambda$static$0(WebPage.java:130)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.webkit.WebPage.<clinit>(WebPage.java:129)
at javafx.scene.web.WebEngine.<init>(WebEngine.java:858)
at javafx.scene.web.WebEngine.<init>(WebEngine.java:845)
at javafx.scene.web.WebView.<init>(WebView.java:271)
... 39 more
Error occurred on line: 26 (Main)
java.lang.RuntimeException: Object should first be initialized (WebView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32)
at anywheresoftware.b4j.objects.NodeWrapper.innerInitialize(NodeWrapper.java:83)
at anywheresoftware.b4j.objects.WebViewWrapper.innerInitialize(WebViewWrapper.java:33)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:148)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:166)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:78)
at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:81)
at b4j.example.main._appstart(main.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.shell.She
ll.runMethod(Shell.java:612)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at b4j.example.main.start(main.java:36)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImp
l.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
at java.lang.Thread.run(Thread.java:745)
I'm using B4J v4.20(1)
I've followed all the instructions given at this post:
https://www.b4x.com/android/forum/t...n-raspberry-pi-help-needed.63403/#post-400773
but the result is the same as the second above.
It is possible to have a detailed list with all the steps to follow, in order to have a JavaFX fully working?
I'm doing something wrong but really do not understand now where. Please could you help?
In attachment is the zipped test project.
Thank you for your support.
Best regards,
Michele.
Edit: UI apps are no longer supported on Raspberry Pi. Non-ui apps work great and you can show an interface through the browser by implementing a web server.
The first step is to download and run B4J-Bridge:
Remote debugging with B4J-Bridge
Raspberry Pi is a low-cost Linux board:
B4J v1.50 adds support for these boards.
Here are two screenshots:
DBUtils:
Moving smiley:
Out of the box the default OS includes Java 7. However it doesn't include JavaFX libraries.
Non-UI applications will work with this version.
If you want to run UI applications then you need to install Java 8:
https://jdk8.java.net/download.html
You need to download Linux ARMv6/7 VFP, HardFP ABI.
Copy it to the board and unpack it. There is no installation step. You should use the full path from the terminal.
For example:
/<path to jdk1.8>/jre/bin/java -jar DBUtils.jar
UI apps will run in a full screen mode. You cannot resize the window and there is no close button. Be sure to include one in your program. You can also kill it through SSH:
ps -A|grep java
kill <pid>
You will probably need to add more memory to the video card in the board settings, otherwise you will see all kinds of OpenGL errors.
The performance is quite bad. Especially the loading time. However it is usable.
I was a bit surprised to see that even the SQLite driver worked on the first time.
WebView and HtmlEditor nodes are not supported. MediaPlayer is also not supported.
You can also run server applications on these boards:
http://www.b4x.com/android/forum/threads/server-building-web-servers-with-b4j.37172/