B4J Question HttpJob in Libraries

Blueforcer

Well-Known Member
Licensed User
Longtime User
I want to create a library wich needs to download a file.
Lib and MainApp uses jOkHttpUtils2

i test it very simple:

Lib:

B4X: Copy
Sub Class_Globals
    Private fx As JFX
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
  
End Sub

Sub download
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("https://www.google.com")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
    End If
    j.Release
End Sub


Mainapp:

B4X: Copy
    Dim t As TestLib
    t.Initialize
    t.download


but i get this error:

Waiting for debugger to connect...
Program started.

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:496)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:467)
at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:541)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:120)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:487)
... 9 more
Caused by: java.lang.NullPointerException
at b4j.example.httputils2service._submitjob(httputils2service.java:125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
... 10 more
 
Using b4xlibs will not work with ABplugin,
I will try to use the Sourcecode of okhhtputils directly.

Too bad, It used to work in the past.
It's nice when everything becomes simpler and simpler, but it's unfavorable when possibilities are lost.
 
Last edited:
Upvote 0

Similar Threads

Back
Top