summaryrefslogtreecommitdiffstats
path: root/luni/src/main
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-04-03 22:55:03 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-04-03 22:55:04 +0000
commitdf945d726e02034dafdcf7469f71865b86dc3e9d (patch)
treece73112c2641ea3c28e34a886e1795d7ac3016a1 /luni/src/main
parente471f800ea4b4a8549ac2d4979261a499fc0d81e (diff)
parent1bc030b6c8a52e1911efcd58d6fbc7f982649167 (diff)
downloadlibcore-df945d726e02034dafdcf7469f71865b86dc3e9d.zip
libcore-df945d726e02034dafdcf7469f71865b86dc3e9d.tar.gz
libcore-df945d726e02034dafdcf7469f71865b86dc3e9d.tar.bz2
Merge "Finish moving away from LD_LIBRARY_PATH on Android."
Diffstat (limited to 'luni/src/main')
-rw-r--r--luni/src/main/java/java/lang/System.java5
-rw-r--r--luni/src/main/native/java_lang_System.cpp16
2 files changed, 16 insertions, 5 deletions
diff --git a/luni/src/main/java/java/lang/System.java b/luni/src/main/java/java/lang/System.java
index 7cf3993..3f72c95 100644
--- a/luni/src/main/java/java/lang/System.java
+++ b/luni/src/main/java/java/lang/System.java
@@ -356,11 +356,6 @@ public final class System {
}
p.put("java.home", javaHome);
- String ldLibraryPath = getenv("LD_LIBRARY_PATH");
- if (ldLibraryPath != null) {
- p.put("java.library.path", ldLibraryPath);
- }
-
p.put("java.specification.name", "Dalvik Core Library");
p.put("java.specification.vendor", projectName);
p.put("java.specification.version", "0.9");
diff --git a/luni/src/main/native/java_lang_System.cpp b/luni/src/main/native/java_lang_System.cpp
index f8b98b1..944c0c3 100644
--- a/luni/src/main/native/java_lang_System.cpp
+++ b/luni/src/main/native/java_lang_System.cpp
@@ -34,6 +34,10 @@
#include <time.h>
#include <unistd.h>
+#if defined(HAVE_ANDROID_OS)
+extern "C" void android_get_LD_LIBRARY_PATH(char*, size_t);
+#endif
+
static void System_log(JNIEnv* env, jclass, jchar type, jstring javaMessage, jthrowable exception) {
ScopedUtfChars message(env, javaMessage);
if (message.c_str() == NULL) {
@@ -82,6 +86,18 @@ static jobjectArray System_specialProperties(JNIEnv* env, jclass) {
properties.push_back("android.zlib.version=" ZLIB_VERSION);
properties.push_back("android.openssl.version=" OPENSSL_VERSION_TEXT);
+ const char* library_path = getenv("LD_LIBRARY_PATH");
+#if defined(HAVE_ANDROID_OS)
+ if (library_path == NULL) {
+ android_get_LD_LIBRARY_PATH(path, sizeof(path));
+ library_path = path;
+ }
+#endif
+ if (library_path == NULL) {
+ library_path = "";
+ }
+ properties.push_back(std::string("java.library.path=") + library_path);
+
return toStringArray(env, properties);
}