Fix crash

This commit is contained in:
khanhduytran0 2020-10-16 12:36:15 +07:00
parent ec6a13ca39
commit 4c61db11ac

View File

@ -18,8 +18,18 @@ public class JREUtils
private static String nativeLibDir;
private static String findInLdLibPath(String libName) {
for (String libPath : Os.getenv("LD_LIBRARY_PATH").split(":")) {
File f = new File(libPath, libName);
if (f.exists() && f.isFile()) {
return f.getAbsolutePath();
}
}
return libName;
}
public static void initJavaRuntime() {
dlopen("libjli.so");
dlopen(findInLdLibPath("libjli.so"));
// As we set LD_LIBRARY_PATH, so it's not required to preload them
/*
@ -156,9 +166,8 @@ public class JREUtils
private static void setEnvironment(int launchType, String name, String value) throws Throwable {
if (launchType == Tools.LTYPE_PROCESS) {
Tools.mLaunchShell.writeToProcess("export " + name + "=" + value);
} else {
Os.setenv(name, value, true);
}
Os.setenv(name, value, true);
}
public static native int chdir(String path);