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

Code: Copy
java.lang.IllegalStateException: Toolkit not initialized

Using the code modules instead works fine. What did I miss here?
 
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

Upvote 0
you can not use jHttputils2 lib as it is JavaFx based

vbf63.jpg
 
Upvote 0
If you go over the source code you will see that it uses the UI compiler directive to exclude the problematic sub:
Code: Copy
#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
Back
Top