0

I am running a Java application using Termux. I need a media folder to store a folder named DSKEYS with pfx key file because the Java application needs that pfx file from media/DSKEYS/.

I could not find the media folder inside usr, so I created it myself and copied the DSKEYS folder with the pfx file into it. However, the pfx key cannot be found by the application.

Where is the media folder on Termux?

2
  • Also posted on Unix.SE with more context: unix.stackexchange.com/q/749632/90391
    – Andrew T.
    Commented Jun 23, 2023 at 6:52
  • Welcome to Android Enthusiasts. There's probably some missing context on this question compared to your question on Unix.SE that the Java app is supposed to run on Linux OS, not Android OS. While I don't know how the app works (e.g. where the app looks for the exact path specifically), perhaps Where is the folder that Termux defaults to? might help. Good luck.
    – Andrew T.
    Commented Jun 23, 2023 at 6:56

1 Answer 1

0

Recently I myself have come across this situation and can say with confidence that the question is perfectly valid. Termux is an Android terminal emulator and Linux environment application that works directly with no rooting or setup required. A minimal base system is installed automatically, additional packages are available using its package manager - pkg (https://wiki.termux.com/wiki/Main_Page).

You can install Java Runtime Environment with pkg:

pkg search openjdk

if you find a version of openjdk available, for example: presently openjdk-17 is available

install it using command:

pkg install openjdk-17

However, undoubtedly there are several important differences between Termux and a real Linux environment, one of which is certainly the directory structures. Termux does not follow Filesystem Hierarchy Standard unlike majority of Linux distributions. You cannot find directories like /bin, /etc, /usr, /tmp, /media and others at the usual locations. Thus, all programs must be patched and recompiled to meet requirements of the Termux environment otherwise they will not be able to find their configuration files or other data.

Luckily there is an alternative way to solve this problem in certain situations: if you need a classical Linux file system layout, you may try to use termux-chroot (command) from package 'proot':

For more info please refer to https://wiki.termux.com/wiki/Differences_from_Linux.

pkg install proot

after the installation, to obtain linux-like file system layout run command right inside Termux:

termux-chroot

After that you should be able to see standard linux paths like /tmp, /etc, /usr and others. If you still don't see /media folder, create it with commands:

cd /
mkdir media
cd media
mkdir DSKEYS

or:

cd /
mkdir -p media/DSKEYS

and place your .pfx files in here.

If everything is done right Java application should be able to see your files without problems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .