B4J Question non-ui -> jHttpUtils2 -> Toolkit not initialized?

KMatle

Expert
Licensed User
Longtime User
Maybe I'm getting old (and I missed something), but..

Adding the jHttputils2 lib does not work. Submitting a job (Download2) gives

B4X:
java.lang.IllegalStateException: Toolkit not initialized

Using the code modules instead works fine. What did I miss here?
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

as building a Non-UI application, you can not use jHttputils2 lib as it is JavaFx based.

Use instead the code modules httpjob and httputils2service. See attached example.
 

Attachments

  • B4JHowToNonUIHTTP.zip
    10.8 KB · Views: 421
Upvote 0

KMatle

Expert
Licensed User
Longtime User
you can not use jHttputils2 lib as it is JavaFx based

vbf63.jpg
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
If you go over the source code you will see that it uses the UI compiler directive to exclude the problematic sub:
B4X:
#If UI
'Returns the response as a bitmap
Public Sub GetBitmap As Image
   Dim b As Image
   b = fx.LoadImage(HttpUtils2Service.TempFolder, taskId)
   Return b
End Sub
#End If
The compiled jHttpUtils2 library was compiled from a UI project so it can only work with a UI project.
 
Upvote 0
Top