File size: 407 Bytes
2d741b1
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
"""Make an optional portable JRE visible without changing the system PATH."""
from pathlib import Path
import os, shutil

def activate_java():
    if shutil.which('java'): return True
    root=Path(__file__).resolve().parent/'runtime/java'
    for binary in root.glob('*/bin/java.exe'):
        os.environ['PATH']=str(binary.parent)+os.pathsep+os.environ.get('PATH','')
        return True
    return False