Java 22

tchart

Well-Known Member
Licensed User
Longtime User
Java 22 is not LTS (long term support).

Dont use non-LTS releases...
 

peacemaker

Expert
Licensed User
Longtime User
In whole the question - why is it not good to use some latest Java SDK with B4X ?
Is it not the best (latest improved\fixed errors) if to update the SDK files set ?

Anyway, Java version 22 is detected not correct as 8 (v.18, 19 are detected correctly). And JavaFX is "not visible" (sure, /javafx folder is here).
 
Last edited:

tchart

Well-Known Member
Licensed User
Longtime User

I have no problem with latest versions, the problem is with non-LTS version. They have a very limited lifespan. Java 22 is only supported until September 2024 - https://www.oracle.com/java/technologies/java-se-support-roadmap.html

Besides that there are usually problems with new releases that may never be resolved since support will end very promptly.

e.g. https://www.theverge.com/2024/3/17/...acos-sonoma-14-4-on-apple-silicon-breaks-java

Imagine your app becomes very popular and then a bug/vulnerability is discovered in the JRE you distributed. Then it becomes an admin nightmare for you.
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
Perhaps you should visit this thread post #2: https://www.b4x.com/android/forum/threads/update-openjdk.140167/#post-887747
That is the structure of the JDK Setup

You can also use this to point to the java directory
B4X:
#JavaCompilerPath: 18, C:\java\jdk-18\bin\javac.exe
 

Daestrum

Expert
Licensed User
Longtime User
Java 22 runs fine, but you MUST add the line below if you want to write a UI app as @mcqueccu pointed out.
B4X:
#JavaCompilerPath 22, C:/java22/bin/javac.exe

I currently use java 14 - for B4R
java 21(LTS) and java 22 (just to try new features out)
 

peacemaker

Expert
Licensed User
Longtime User
just to try new features out

It is the initial reason of the question: what new\better features we obtain in B4X projects if to update the JDK version ?
 

Sagenut

Expert
Licensed User
Longtime User
It is the initial reason of the question: what new\better features we obtain in B4X projects if to update the JDK version ?
You could benefit from some bug fix or corrected vulnerability.
But if latest Java contain even new functionalities you will not benefit of them until B4A will be upgraded to use them.
I think it should work in this way.
But as told before, better to stick to LTS version for better support.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
But if latest Java contain even new functionalities you will not benefit of them until B4A will be upgraded to use them.
Not exactly correct.
1. We are talking about B4J here.
2. B4J doesn't need to be upgraded to use new features of Java. Like any native API, it should be called with a new library or JavaObject or inline Java.
 

peacemaker

Expert
Licensed User
Longtime User
Seems, clear: B4X compilers, i think, use some fixed code patterns to implement functions, and they will not be changed until Erel may edit the IDE code.
So, benefit is just for bug fixes from new SDK only.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…