Note that you don't need to implement anything for this. Just run the server and you can serve files from the 'WWW' folder.
Since I only need download service, I changed the codes into these
Sub AppStart (Args() As String)
srvr.Initialize("srvr")
srvr.Port = 54021
srvr.Start
Log("Server started")
StartMessageLoop
End Sub
On B4J IDE, it runs OK, but on command prompt, with this command
Error raised :
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: anywheresoftware/b4a/BA
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: anywheresoftware.b4a.BA
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
I am using java version "1.8.0_201"