0

What I'm trying to do is export JAVA_HOME path from inside a python script.

Reasons for this:

  1. Kodi addons are all written in python.
  2. Bluray and UHD Bluray menus require JAVA (JRE) to run.
  3. I want to add this to Android and most boxes are not rooted, like the Nvidia Shield.

I'm using a JRE for ARM based devices named Zulu.

My code so far:

import os
os.system('export JAVA_HOME=/storage/emulated/0/JAVA/bin/java')
os.system('export PATH=$PATH:$JAVA_HOME/bin')

Sadly, this isn't working.

EDIT: The proposed solution solves the problem that uses your os.environ. I would like to change an environment path for the entire OS just like exporting JAVA_PATH from a shell.

  • 1
    @Joe if I understand correctly those examples result in the python script and it's subprocess to receive the environment path, correct? If this is true, this will not work if the Kodi app calls the script and a different call from Kodi checks for JAVA_HOME? Since it's just passed along to subprocess of the python script. So it's not possible to modify a env var for the entire system? – Vitor Oliveira Jun 07 '20 at 13:36
  • 1
    No, it's [not possible to change an environment variable in a parent process](https://stackoverflow.com/questions/263005/is-it-possible-to-change-the-environment-of-a-parent-process-in-python). – Joe Jun 07 '20 at 14:45

0 Answers0