B4J Question B4J Libraries and Java 11+ Compatibillity with previous projects

ThRuST

Well-Known Member
Licensed User
Longtime User
I have installed the latest (at the time posting) B4J v7 and Java 11.

I want to make my huge project Athena compatible with this latest Java version.
That's why I ask the neccessary libraries to be updated to work with the latest Java version.

This is the error I get when I run my project Athena

B4JError.JPG


Libraries used

B4JLibs.JPG


It used to work with SDK v9.0.4 but as you all understand I have to keep up to date with the latest updates of Java, so I am asking for updates of the included libraries for whom it may concern.

Thanks
 

ThRuST

Well-Known Member
Licensed User
Longtime User
@stevel05 Under floatingMenuMain this came up, is that's what causing error with Java 11?

B4X:
' List availble Drives
            Dim fsv As JavaObject
            fsv.InitializeStatic("javax.swing.filechooser.FileSystemView")
          
            Dim Namelenght As Int
            Dim Tstring As String

                For Each drive As Object In ListRoots
                    Tstring = drive                 
                    MainMenu.Add(FloatingMenuMAIN.MenuText2(drive & " " & fsv.RunMethodJO("getFileSystemView",Null).RunMethod("getSystemDisplayName",Array(drive))).SetTag("Unit " & drive).SetGraphic(FloatingMenuMAIN.NewImage(File.DirAssets, "Drive.png")))
                Next

This code lists the drive names if I remember correctly. Someone told me to add this line not sure who it was, so if that someone remembers it let me know!!
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
I put together a real small Test app in JDK v9.0.4 just to see if it could run while Oracle JDK v11.0.2 is installed, but it won't run.

Can anyone please confirm this. I have both JDK v9.0.4 and JDK 11.0.2 installed.

Not sure if Launch4j will solve this. Would like to know how. Launch4j is here
 

Attachments

  • Java9App.jar
    364.7 KB · Views: 265
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I don't think so, your error was module javafx.swing, this is javax swing. And it initializes using Open Javafx 11.0.1
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
I'm trying to figure out how to run a Java 8/9 app under Java 11. That will makes a huge difference. On the crossroads of fate here
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Your test app runs fine here under openJDK11.0.2+7 + javafx-sdk-11.0.2

It's how you run it under 11 that will cause most problems.

Double clicking the jar wont work as it needs 2 extra bits of information
1, Where the modules for javafx are located
2, a command to add the controls modules.

simply put - its easier to run from a batch file(or equivalent)

I just add a few lines of code to my app to create the batch file for me

in appstart I have
B4X:
#If Release
 makeRunner("test1") ' name of the output jar usually the same as this filename
#End If

and a sub called makeRunner
B4X:
Sub makeRunner(jar As String)
 Dim out As TextWriter
 out.Initialize(File.Openoutput("","runner.bat",False))
 out.WriteLine("rem Generated run file")
 out.WriteLine($"java --module-path=D:\javafx-sdk-11.0.2\lib --add-modules=javafx.controls -jar ${jar}.jar"$)
 out.WriteLine("pause")
 out.Flush
 out.close
End Sub

This will create a file called runner.bat, in the same directory as the jar, that I can double click to run the app.

Obviously you may need to change the path to where your openjfx is located.
The path seems rather picky. If the path has a space in it you can use " " around the path, if it doesn't have a space you can't use " " around it.
 
Last edited:
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
@Daestrum Darn, you're on to something big here. A new standard we should use.
Remember my earlier testapp for Mac? It's possible to get the path to where Java is installed...
We'll use that to autodetect the path, simple and powerful. That's do the job.
now, JUST DO IT!!!
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Have you installed openJFX 11 (installed as in unpacked the zip to a directory)?
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Great!! I think we can solve this.. downloading it now!
 
Last edited:
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
no I haven't installed that, Oracle vs OpenJFX11 caused a dilemma.. I should install it.

Thinking about the free vs commercial license.. but perhaps this way will work with Oracle's solutions as well?

(I don't expect you to know this just yet)
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
I dont think javafx is in oracle java 11 anyways now. (not 100% certain)
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
The most important question for me in this thread is - can I still develope using JDK v9.0.4 and use the B4jPackager and make my project run regardless of what new JAva versions that is available and installed in peoples computers?
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
It causes a drama in for me because I cannot get my project to work.

Will you help me with this?
 
Upvote 0
Top