Other B4J v6.80 BETA with support for Java 11

Erel

B4X founder
Staff member
Licensed User
Longtime User
Java 11 is the next long time supported version after Java 8. Oracle, the owners of Java made all kinds of changes to Java license. While it will still be possible to use older versions of Java without a paid license, they are pushing developers to OpenJDK + OpenJFX. These are the open source versions of Java. Note that their license (GPL + classpath exception) permits usage in commercial closed-source projects.

B4J v6.80 adds support for Java 11. The changes required were mostly internal. Previous versions of Java are also supported.

How to run Java 11?

1. Download Java 11 with the required components: http://b4xfiles-4c17.kxcdn.com/jdk-11.0.1.zip
This package includes the following components: OpenJDK 11 and OpenJFX 11.0.1 (SDK + jmods).

2. Unzip the package. You can put it anywhere you like. C:\Java11 is a good place.

3. Choose Tools - Configure Paths in the IDE and choose the new Java.

B4JPackager will not work with Java 11. The good news is that there is a better tool available. It is written in B4J and it can be customized as needed. The tool name is B4JPackager11.

More about B4JPackager11: https://www.b4x.com/android/forum/t...the-simplest-way-to-distribute-ui-apps.99835/

Notes

- A new version of B4J-Bridge was released (v1.42). It is required for Java 11. If you are running Java 11 on the PC then you should also run Java 11 on the remote computer.
- UI runnable jars are not supported in Java 11+.

Download link:

B4J v6.80 BETA: www.b4x.com/b4j/files/beta.exe
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4JPackager11 v0.91 is released. It adds another step that is responsible for finding additional dependencies.

There are also two new lists with explicitly excluded and included modules. javafx.web is excluded by default as this is a large module (~30mb) which is not needed unless you use WebView:
B4X:
ExcludedModules = Array("javafx.web") 'comment this line if using WebView

About code signing, the setup file generated by Inno Setup should be signed. Currently B4JPackager11 only creates a template setup script. It is expected that developers will modify this script. The signing tool can be executed as part of this script: http://www.jrsoftware.org/ishelp/index.php?topic=setup_signtool
 
Upvote 0

udg

Expert
Licensed User
Longtime User
it is better than relying on the customer having the correct Java version installed
This one is easy to agree on. At least for a desktop app.
When deploying on a VPS server (in the future), IMHO it will be annoying to have as many JRE (even at different relase steps) as apps installed. In that case the single JRE is easier and, after all, is controlled by us who are supposed to know which version is better for our software.

Anyway, I understand that you're offering a solution for a decision taken by others, so thank you and keep on with your excellent job.

udg
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
It seems that jSerial is not compatible with Java11 anymore

B4X:
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=2732, tid=8332
#
# JRE version: OpenJDK Runtime Environment (11.0.1+13) (build 11.0.1+13)
# Java VM: OpenJDK 64-Bit Server VM (11.0.1+13, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [jSSC-2.8_x86_64.dll+0xb5db]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Stephan\ONEDRI~1\B4J\AwtrixPi\Objects\hs_err_pid2732.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
It seems that jSerial is not compatible with Java11 anymore

B4X:
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=2732, tid=8332
#
# JRE version: OpenJDK Runtime Environment (11.0.1+13) (build 11.0.1+13)
# Java VM: OpenJDK 64-Bit Server VM (11.0.1+13, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [jSSC-2.8_x86_64.dll+0xb5db]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Stephan\ONEDRI~1\B4J\AwtrixPi\Objects\hs_err_pid2732.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

I fixed that.
 
Upvote 0

Dadaista

Active Member
Licensed User
Longtime User
B4J 6.80 Beta #1 installed.
Path in B4J IDE point to Java11 (java11 Downloaded from post #1)
I get this error when I run application from installation Setup, made from inno script and when the app sends an email.

Java Error.png

No error from B4J IDE (after jssecacerts file is copied to java11 directory).:rolleyes:o_O... if the file is not copied, also error in IDE.
What I must do? something goes wrong:oops: How I fix this?
 
Upvote 0

IndieDev

Active Member
Licensed User
Hi,

Using the 6.80 Beta #1 with OpenJDK 11.0.1.

When executing Compile & Run, crashes with this error:
main._appstart (java line: 88)
java.lang.NullPointerException
at anywheresoftware.b4j.objects.Form.getIcon(Form.java:275)
at anywheresoftware.b4j.objects.JFX.setOwnerAndIcon(JFX.java:161)
at anywheresoftware.b4j.objects.JFX.Msgbox2(JFX.java:205)
at anywheresoftware.b4j.objects.JFX.Msgbox(JFX.java:185)
at pk.x264.main._appstart(main.java:88)
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:91)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at pk.x264.main.start(main.java:37)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)

Same code used to work with the B4J 6.51
(Not made any changes in code. Any required for this Beta?)
 
Upvote 0

Dadaista

Active Member
Licensed User
Longtime User
Copy the jssecacerts file to the generated bin folder and run debug_run.bat (without creating the setup). Does it work?

No. It does not work:(

This is the output

B4X:
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
        at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
        at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
        at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
        at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(Unknown Source)
        at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(Unknown Source)
        at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(Unknown Source)
        at java.base/sun.security.ssl.SSLHandshake.consume(Unknown Source)
        at java.base/sun.security.ssl.HandshakeContext.dispatch(Unknown Source)
        at java.base/sun.security.ssl.HandshakeContext.dispatch(Unknown Source)
        at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
        at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
        at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
        at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
        at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
        at b4j/org.apache.commons.net.smtp.AuthenticatingSMTPClient.performSSLNegotiation(Unknown Source)
        at b4j/org.apache.commons.net.smtp.AuthenticatingSMTPClient.execTLS(Unknown Source)
        at b4j/anywheresoftware.b4a.net.SMTPWrapper$1.run(Unknown Source)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at java.base/sun.security.validator.PKIXValidator.doBuild(Unknown Source)
        at java.base/sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
        at java.base/sun.security.validator.Validator.validate(Unknown Source)
        at java.base/sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
        at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
        at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
        ... 19 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)
        at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
        at java.base/java.security.cert.CertPathBuilder.build(Unknown Source)
        ... 25 more
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
 
Last edited:
Upvote 0

IndieDev

Active Member
Licensed User
Hi,

Project file attached.

(Have removed ffmpeg.exe from the Files folder, to upload.)
 

Attachments

  • pkX264.zip
    225.5 KB · Views: 329
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
No. It does not work:(

This is the output
Please start a new thread for this.

Hi,

Project file attached.
There are several mistakes in your program.

1. CheckJavaVersion code is incorrect.
2. Why aren't you using the passed Form1 parameter ?
B4X:
MainForm = Form1
3. Because of the wrong CheckJavaVersion and the uninitialized MainForm this code cannot work:
B4X:
If Global.CheckJavaVersion(JavaVersionTarget) = False Then
   fx.Msgbox(MainForm, "This App requires minimum Java Version " & JavaVersionTarget & "." & CRLF & CRLF & _
       "Your version is " & Global.GetJavaVersion & ".", "PK x264 converter")
   ExitApplication
End If

Start a new thread if it is not clear.
 
Upvote 0
Top