B4J Question jOkHttpUtils2 vs jOkHttpUtils2_NONUI Creating a single library that work on both

max123

Well-Known Member
Licensed User
Longtime User
Hi everyone,

I'm writing a B4J library that use jOkHttpUtils2 and I would like to create the same library that works in both UI and NONUI projects.

I know that jOkHttpUtils2 has dependencies on JavaFx as the GetBitmap method exists, so what I did was import in my UI project the source code of jOkHttpUtils2 (so HttpJob and HttpUtils2Service), at this point on HttpJob module I could see directive "#If UI" is in the line "Private fx As JFX" that even on GetBitmap method.

This so in theory it should work with both UI and even with NONUI projects, but unfortunately it is not.

NOTE: In my library I don't need GetBitmap method, maybe only in future, but this is not sure.

After trying that with UI works, I exported the library with "Compile To Library" but, creating a new NONUI project, import a library and use, when I execute I get the fateful error "Toolkit not initialized".

I also tried to comment on jOkHttpUtils2 all JavaFx dependencies and then recompiled as library, but nothing changes.

Perhaps this is due to the fact that I compile the library with "Compile To Library" while I am using a UI project, so it is not compatible with NONUI projects?

Is there anyway to make this and release only one library or I do have to release 2 different libraries, one _UI and another _NONUI ?

Thank you all.
 
Last edited:

max123

Well-Known Member
Licensed User
Longtime User
Any suggestion?

Please help me or I need to release my library in 2 versions _UI and _NONUI
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
See my PM to you on how to use jOkHttpUtils2 in a non-ui application.
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
OK Erel, many thanks. ;)

I'll create two versions of my library, _UI and _NONUI
 
Upvote 0
Top