I've been using OpenJDK 14 + OpenJFX 14 from Erels beta release post for a couple of years now for all my B4X projects, it works perfect. My wish is simply to hope that Anywhere Software updates to OpenJDK 18 + OpenJFX 18 sooner rather than later, especially as the B4A and B4J download pages...
Note that you can use any version of OpenJDK you like. You just need to download the three pieces and put them in the right place:
- OpenJDK
- JavaFX SDK + jmods: https://gluonhq.com/products/javafx/
JavaFX SDK should be in javafx folder.
JavaFX jmods should be in javafx\javafx-jmods folder
I think using the later versions is good as a lot of the code has been optimized for faster performance.
But.... B4X won't let you use any new features (even in in line java) because of the hard-coded Target and Source switches, these basically limit the compiler to use features in the target/source version, which last time I looked was 11.
But I could be wrong regarding the Target/Source nowadays.
It seems JavaFX 17 is no longer available for download.
See post #25
Then I tried OpenJDK 17.0.2 + JavaFX SDK 19.0.2.
Edit: It is working fine but I see a warning message. It seems conflict occurs in jOkHttpUtils2 library.
B4X:
WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
Program started.
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
But.... B4X won't let you use any new features (even in in line java) because of the hard-coded Target and Source switches, these basically limit the compiler to use features in the target/source version, which last time I looked was 11.
Maybe @aeric can prepare his bundle of the updated files he used OK, and @Erel can publish it as the new beta-version for trial period ?
The community will test it with own projects, reporting about the result and ... if OK, later the bundle will be the new recommended one in the installation steps.
Maybe @aeric can prepare his bundle of the updated files he used OK, and @Erel can publish it as the new beta-version for trial period ?
The community will test it with own projects, reporting about the result and ... if OK, later the bundle will be the new recommended one in the installation steps.
I think Erel has his own ways to test which bundle works.
I am not expert in Java. So far I just tested to use the new versions downloaded from the recommended sites. Usually the latest version is better but LTS is more favorable.
OpenJDK 19.0.2 (choose Windows / x64 zip and extracted as jdk-19.0.2 folder under C:\Java)
Download: https://jdk.java.net/19/
JavaFX 19.0.2 (extract the SDK to jdk-19.0.2 directory extracted above as javafx folder, jmods into this javafx directory as javafx-jmods)
Download: https://gluonhq.com/products/javafx/
Optional step: copy the oldimpl folder from JDK 11 and paste inside the \javafx\lib\javafx.swing.jar (I made a backup)
to suppress a warning in B4J IDE logs
I've been using OpenJDK 14 + OpenJFX 14 from Erels beta release post for a couple of years now for all my B4X projects, it works perfect. My wish is simply to hope that Anywhere Software updates to OpenJDK 18 + OpenJFX 18 sooner rather than later, especially as the B4A and B4J download pages...
Can we use Preview features in B4J? I am getting error.
B4X:
B4J Version: 9.80
Parsing code. (0.00s)
Java Version: 19
Building folders structure. (0.01s)
Compiling code. (0.00s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Compiling generated Java code. Error
B4J line: 18
End Sub
src\b4j\example\main.java:74: error: patterns in switch statements are a preview feature and are disabled by default.
case String s && s.length() > 5 -> System.out.println(s.toUpperCase());
^
(use --enable-preview to enable patterns in switch statements)
1 error
only showing the first 1 errors, of 5 total; use -Xmaxerrs if you would like to see more