B4J Question ABMaterial issue in linux

techknight

Well-Known Member
Licensed User
Longtime User
I am having a weird issue with my system running Jessie.

So, on the root of the drive I have a folder called GPS18 and that is where my jar and www is in plus other things.

When I start it with this command, I get this:
B4X:
root@srv1:/# java -jar /GPS18/GPS18.jar
abmapplication._vvvvvvvvvvvvvv3 (java line: 46)
java.lang.NullPointerException
        at java.io.File.<init>(File.java:277)
        at com.ab.abmaterial.ABMaterial.CheckApp(Unknown Source)
        at com.ab.abmaterial.ABMaterial.WritePageToDisk(Unknown Source)
        at com.majordisplay.cgps18.abmapplication._vvvvvvvvvvvvvv3(abmapplication.java:46)
        at com.majordisplay.cgps18.main._appstart(main.java:63)
        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:90)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
        at com.majordisplay.cgps18.main.main(main.java:29)

But if I go into the directory, and start it with this:

B4X:
root@srv1:/GPS18# java -jar GPS18.jar
loading /GPS18: copymewithjar.needs...
Using cache system: 3.0
Current App version: 1546457629210
..... on and on

it works fine. Because of this issue, I cant daemonize the service.... Grr....

Also when its running, I will get a /GPS18/www/GPS18/images/splash.jpg not found which isnt correct because the file is there.

B4X:
Waiting for value (66 ms)
Waiting for value (97 ms)
/GPS18/www/GPS18/images/splash.jpg
Not Found
^Croot@srv1:/GPS18# cd www
root@srv1:/GPS18/www# cd GPS18
root@srv1:/GPS18/www/GPS18# cd images
root@srv1:/GPS18/www/GPS18/images# ls
appimage.png  ctclogo.gif  splash.jpg
root@srv1:/GPS18/www/GPS18/images# ls -la
total 2392
drwxrwxrwx 2 root root    4096 Dec 20 14:43 .
drwxrwxrwx 5 root root    4096 Jan  2 15:24 ..
-rwxrwxrwx 1 root root 2182759 Sep 21 07:45 appimage.png
-rwxrwxrwx 1 root root   30047 May  4  2015 ctclogo.gif
-rwxrwxrwx 1 root root  222253 Feb 25  2016 splash.jpg <-- its THERE....
root@srv1:/GPS18/www/GPS18/images#

Any ideas?
 

techknight

Well-Known Member
Licensed User
Longtime User
Its a multipurpose server using two NICs. It does run apache serving 2 different websites, as well as running virtualbox with a VM of Win2K8 running yet another server, a nodeJS server. It all works fine. Even this. Until I call it outside of its path then it doesnt.

if I CD into the directory and call it without a path marker, it works.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Yes thats what I ended up doing, It does work this way.

But the question is, WHY?

Why would it crash when started from a different path than being inside the path. I dont get it.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Well then it has to be broken somewhere if it doesn't work when launched from a different path.

What is not making sense to me is it should not matter what path you give java to start the jar, I always figured where the jar was located would matter. But apparently it does so somethings broken somewhere.
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Post a case in the feedback app with a reproducable example (you can mail it to me) and I will have a look.

I always figured where the jar was located would matter
It is complexer than that, as the www folder doesn't always need to be next to the jar. Paths have to be converted all the time between absolute paths in java, relative paths in javascript and HTML tags etc. It is not like there is one simple method in the 105K lines of ABM code that needs to be fixed ;)
 
Upvote 0
Top