B4J Question B4J Packager11 serial port connector broken with OpenJDK11 [solved]

Didier9

Active Member
Licensed User
Trying the packager, it says to use Java 11.
The only installation of Java 11 I have on this machine is OpenJDK, which has a notoriously broken serial port connector implementation, so the app crashes immediately as soon as the program attempts to open the port (in B4J, debug or release, or as a standalone exe).
Is there another version of Java11 that has a working serial port connector?
 

Didier9

Active Member
Licensed User
It is too early for me :(

I am using jSerial v1.31 and the new jssc and the other library file as pointed out in the messages above.
I have deleted the .jssc folder under my Windows profile.
I have pointed B4J to the javac.exe that is in the OpenJDK 11 folder.

The chat program seems to work (except that I cannot open the designer, I get an out of memory error) when B4J is pointed to OpenJDK 11. I have not checked that it actually sends data but it does not crash when opening the port (that is when running from within the IDE)

My project also works when running from within B4J when B4J is pointed to OpenJDK11. I can open the designer with my project. (that is definitely an improvement, before it would not even run from within B4J)

When running the packager, the Chat.exe crashes. I can see the outline of the form popping up then it closes immediately. My project does the same.

I actually have two versions of OpenJDK 11. I have 11.0.1 that I downloaded from the B4X web site some time ago, and I have 11.0.2 which I downloaded from the OpenJDK web site also some time ago. They both do the same thing.

I have attached the project.

Point to a valid COM port and click "Send Test Data". If the button turns green, you are OK, if not, then not...

Now, please don't sweat it on my behalf. It is frustrating not to be able to run with OpenJDK but as long as it works with Oracle Java (and it does at the moment), I am not dead in the water. It's just that I don't like the potential licensing issues with Oracle.
 

Attachments

Erel

Administrator
Staff member
Licensed User
except that I cannot open the designer, I get an out of memory error
It is an old Scene Builder layout, ignore it.

and I have 11.0.2 which I downloaded from the OpenJDK web site also some time ago.
This will not work. Follow the installation instructions: https://www.b4x.com/b4j.html

First step is to delete the Java you installed not based on the instructions.
Second step is to ignore the Scene Builder error.

When running the packager, the Chat.exe crashes. I can see the outline of the form popping up then it closes immediately.
You should run the debug batch file and see the error message.
 

bdunkleysmith

Active Member
Licensed User
Hi Didier,

I see we have a few things in common - we are both amateur radio operators, keen on using the VHF bands and even 10GHz for field day work. My callsign is VK3YFL and I have some station info here. I realised that when I downloaded your project and saw it had a reference to "Thunderbolt". You can see my Thunderbolt GPSDO which I use to stabilise my 10GHz transverter in one of the videos of my field day setup on that webpage.

I have downloaded your project and it ran successfully, at least the "Send Test Data" button flashes green and the "Data Mode" button turns green, when run from the IDE. I them used B4JPackager11 and the resultant result.exe also runs similarly.

1587903648507.png


As for the two versions of OpenJDK11, I believe one must use the version downloaded from the B4J Installation page because the associated files have some particular structure required by B4J.

I'm not sure if that's any help, but like you I wanted to migrate from Oracle Java to OpenJDK to avoid any application licensing limitations and it took a bit of persistence before I got everything working such that I felt comfortable on OpenJDK, using B4JPackager11 and creating an installer.
 
Last edited:

Didier9

Active Member
Licensed User
Interesting confluence! This project is a tool to help configuring the WiFi module that is an option for my current Thunderbolt Monitor :)
(there is an Android app, in B4A of course that goes with it.) I published the original kit in 2008!

At the moment my ham radio hobby is somewhat dormant, overcome by an extremely busy lifestyle as I approach retirement... I am sure I will get back in it once retired, it was a lot of fun.

Yes, it looks like my OpenSDK installation is botched.

When I installed it originally from this site, it was version 11.0.1 but the serial connector was broken, and googling the issue brought me to a version that was fixed but was based on 11.0.2. I spent a good bit of time messing with it until I could run an app from within B4J (adding jfx and other things, I forgot) with it but the packager never worked. I just now found out the version on this site has been fixed recently and as shown the serial connector works, so as Erel suggested, I will wipe both and start fresh.

Thanks for trying it!

Thank you both!
 
Last edited:

Didier9

Active Member
Licensed User
I have deleted both older Java 11 versions and installed 11.0.1 from this site.
well, the app works when run from within B4J (which is also looking at the new Java 11 installation) but the exe still crashes immediately.
I ran the debug batch file (by itself, no argument) and it returned this:

B4X:
C:\Users\Didier\Documents\B4J Projects\B4JPackager11\Objects\temp\build\bin>java.exe @release_java_modules.txt  -m b4j/b4j.example.main
main._appstart (java line: -1)
java.lang.UnsatisfiedLinkError: Could not load the jssc library: Couldn't load library library jssc
        at b4j/jssc.SerialNativeInterface.<clinit>(Unknown Source)
        at b4j/jssc.SerialPortList.<clinit>(Unknown Source)
        at b4j/anywheresoftware.b4j.serial.Serial.ListPorts(Unknown Source)
        at b4j/b4j.example.main._appstart(Unknown Source)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
        at b4j/anywheresoftware.b4a.BA.raiseEvent(Unknown Source)
        at b4j/b4j.example.main.start(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
        at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
        at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Looks like jssc is still causing trouble :(
I have installed the jssc library under ...\Documents\B4J Projects\Libraries which is where I put all the libraries and this is correctly input into the Path window in B4J
 

bdunkleysmith

Active Member
Licensed User
@Didier9 I'm just out of bed and after I deal with a few other things, I take another look, but despite Erel's comment about using the latest version of jSerial, I am suspicious that there is still a problem with the the jssc.jar contained in it when using OpenJDK11 under Windows 10 64 bit and the one from this post is required, including deleting the cache .jssc folder as per that post. I'm currently running with that alternative jssc.jar and so I'll test by reverting to the "latest" one.
 

Didier9

Active Member
Licensed User
You can go right back to bed, it's working :)
Thanks a whole bunch!
This has bugged me to no end.
I originally found a jssc.jar file that was said to have fixed the problem but at the time I read that it only worked with 11.0.2, which is why I went the 11.0.2 route

You just got out of bed? but it's dinner time!
Never mind...

Erel should include these instructions in the installation page, for those who plan on using the serial port. I realize it's not the biggest use case...
 

bdunkleysmith

Active Member
Licensed User
It's great that you've got it working, but just for the record, what was the solution in the end?

Incidentally, when I tried my Thunderbolt at home when a field day was held earlier in the year I noticed the date was being displayed incorrectly and your question on this Forum triggered me to look to see if there was a fix. Indeed I found it and so it looks like I've got a firmware update ahead of me in coming days - another project to fill the hours of "lock down" here Australia!

Enjoy your dinner - would you like to know tomorrow's weather forecast?
 

Didier9

Active Member
Licensed User
Exactly what you said, jssc.jar (and cleaning the .jssc folder), as described here: https://www.b4x.com/android/forum/threads/updated-jssc-jar.99668/#post-627535

The issue with the Thunderbolt is the Week GPS offset. Look at the page for my monitor I linked earlier, near the bottom. There is no firmware upgrade for the Thunderbolt. It looks like your Thunderbolt monitor has a software fix for that. Without it, your date will be off by 19.6 years (1024 weeks) until about 18 years from now... then it will be off by almost 40 years :) It will not affect its performance as a precision frequency reference, but the calendar will be way off.

I just realized VK4GHZ had a fix but it botched at January 1st. Bummer!
We are not locked down here in Florida but discouraged from going out so I mostly work at home and only go to work when I have to, which ends up being every couple of days for a couple of hours but this week will be busier.
 

Attachments

Last edited:
Top