B4J Question Java 8, 11 are both not compiling on my computer.

Beja

Expert
Licensed User
Longtime User
Hi all,
Today I did clean installations of B4J and Java.. first I installed Java 8, then Java 11.. they gave two different errors.
please see the following error descriptions .. Any help with meaning appreciated..
Best, -B

Compiling generated Java code. with Java 11 Error
B4J line: 53
icon1.Initialize(\
src\b4j\example\main.java:122: error: package javafx.scene.image does not exist
_icon1.Initialize(ba,"icon1",(javafx.scene.image.Image)(_img.getObject()),anywheresoftware.b4a.keywords.Common.ArrayToList(_menuitems));

--------------------------------------------------------------
javac 1.8.0_191
src\b4j\example\astart.java:37: error: cannot access JServlet
public String _handle(anywheresoftware.b4j.object.JServlet.ServletRequestWrapper _req,anywheresoftware.b4j.object.JServlet.ServletResponseWrapper _resp) throws Exception{
^
bad class file: C:\B4J\B4J\libraries\jserver.jar(anywheresoftware/b4j/object/JServlet.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
 

Beja

Expert
Licensed User
Longtime User
Edit:
This is the log file
java.lang.NoClassDefFoundError: javafx/scene/image/Image
at anywheresoftware.b4j.objects.ImageViewWrapper$ImageWrapper.Initialize2(ImageViewWrapper.java:146)
at anywheresoftware.b4j.objects.ImageViewWrapper$ImageWrapper.Initialize(ImageViewWrapper.java:139)
at b4j.example.main._appstart(main.java:118)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.main(main.java:28)
Caused by: java.lang.ClassNotFoundException: javafx.scene.image.Image
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more
main._appstart (java line: 118)
java.lang.NoClassDefFoundError: javafx/scene/image/Image
at anywheresoftware.b4j.objects.ImageViewWrapper$ImageWrapper.Initialize2(ImageViewWrapper.java:146)
at anywheresoftware.b4j.objects.ImageViewWrapper$ImageWrapper.Initialize(ImageViewWrapper.java:139)
at b4j.example.main._appstart(main.java:118)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.main(main.java:28)
Caused by: java.lang.ClassNotFoundException: javafx.scene.image.Image
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more
 
Upvote 0

teddybear

Well-Known Member
Licensed User
B4X:
Compiling generated Java code. with Java 11 Error
B4J line: 53
icon1.Initialize(\
src\b4j\example\main.java:122: error: package javafx.scene.image does not exist
_icon1.Initialize(ba,"icon1",(javafx.scene.image.Image)(_img.getObject()),anywheresoftware.b4a.keywords.Common.ArrayToList(_menuitems));
I suspect it is an incomplete for installing java11. you can check if the javafx.graphics.jar is existed in javafx/lib.

B4X:
javac 1.8.0_191
src\b4j\example\astart.java:37: error: cannot access JServlet
public String _handle(anywheresoftware.b4j.object.JServlet.ServletRequestWrapper _req,anywheresoftware.b4j.object.JServlet.ServletResponseWrapper _resp) throws Exception{
^
bad class file: C:\B4J\B4J\libraries\jserver.jar(anywheresoftware/b4j/object/JServlet.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
Try using jServer3 library to compile it with java8 if it is possible
 
Last edited:
Upvote 0

Beja

Expert
Licensed User
Longtime User
What are you trying to do?
As I know, it is impossible to use Image object in a non-ui app. You may need to create another ui app and call it from the non-ui server app or use other approach which doesn't make use of Image.

It's the icon that appears at the taskbar, indicating the server is running.. It was working before.
Like this:
 

Attachments

  • svrIMG.png
    svrIMG.png
    17 KB · Views: 116
Upvote 0
Top