Under review

Cannot create temp directory

Jataki 4 months ago updated by Tom 4 months ago 5

Hi community!

I already contacted Ubooquity's dev on this subject, but thought I'd share so someone can give me their input.

So I had this old rooted smartphone lying around and thought I'd make something out of it by making it a small private home server running Ubooquity for me to access and read around the house.

I installed Termux and Termux-Java, and dowloaded the jar file. I ran it, and it says "ERROR on loading inner JAR: Cannot create temp directory /tmp/JarClassLoader". This happens because the /tmp folder on Android is read only, no matter your privileges - unless you wipe it and recreate it with rw permissions, which I'm avoiding. In Termux, there's a variable TMPDIR which defaults to "/data/data/com-termux/files/usr/tmp". Would Ubooquity be open source and I'd changed this myself but since it is not, if no one can see a solution to this problem, I propose the following solutions:

1. If exists, use the path specified on TMPDIR environment variable, otherwise, maintain current behavior
2. Allow to specify through an argument where to create the temp files

I'm sure both these solutions would be useful in other case scenarios and not just my specific problem.

Thank you all for your time and if anyone has a workaround to this problem, I'm all ears!

Under review

Hi Jataki,

I understand the issue, but I have currently no plan to make Ubooquity runnable on Android (nor do I have any workaround coming to my mind). Sorry.

It doesn't have to be; all I'm asking is a way to specify the temp directory through arguments or environment variables. It's a Linux thing and a Linux approach. I'm sure it'll be useful in more scenarios than this. I completely understand if you don't have the time to do it, but it's not a complex thing to do if you do have the time and not a lot of things in your priority queue for Ubooquity. If you still won't do it, I read a comment of yours from 3 years ago saying you won't open source the project. Has that changed?


Still not opening the source I'm afraid.

if you do have the time and not a lot of things in your priority queue for Ubooquity

Both are an issue, especially since I've been in the middle of big and painful refactoring for quite some time now.

Did you try overriding the java.io.tmpdir property ?

Like that:

java -Djava.io.tmpdir=/path/to/tmpdir -jar Ubooquity.jar


Tom, you beautiful human being, that worked like a charm! I now have a fully working Ubooquity home server running on Android device with a Linux terminal. Thank you so much, that settles my problem! And being so, this is a non issue, you can close it. 

You're moving to Kotlin right? I think I read a comment of yours about that. Is there a specific reason for migrating from Java to Kotlin? 

Again, thank you so much! 

I'm moving to Kotlin for the new code and the parts I have to modify. Most of the code is still Java (both can coexist in the same application) for now

I switched to Kotlin because it is faster to write and safer to use.