comparison src/os/bsd/vm/os_bsd.cpp @ 4960:86ce3208eb18

7145798: System.loadLibrary does not search current working directory Summary: Append "." to java.library.path on MacOS X to ease migration from Apple's Java6 to OpenJDK7. Reviewed-by: phh, jmelvin, coleenp
author dcubed
date Fri, 17 Feb 2012 15:55:27 -0800
parents de268c8a8075
children 0368109684cb
comparison
equal deleted inserted replaced
4935:df4927a3b82e 4960:86ce3208eb18
566 /* That's +1 for the colon and +1 for the trailing '\0' */ 566 /* That's +1 for the colon and +1 for the trailing '\0' */
567 ld_library_path = (char *) malloc(strlen(v) + 1 + strlen(t) + 1); 567 ld_library_path = (char *) malloc(strlen(v) + 1 + strlen(t) + 1);
568 sprintf(ld_library_path, "%s:%s", v, t); 568 sprintf(ld_library_path, "%s:%s", v, t);
569 free(t); 569 free(t);
570 } 570 }
571
572 #ifdef __APPLE__
573 // Apple's Java6 has "." at the beginning of java.library.path.
574 // OpenJDK on Windows has "." at the end of java.library.path.
575 // OpenJDK on Linux and Solaris don't have "." in java.library.path
576 // at all. To ease the transition from Apple's Java6 to OpenJDK7,
577 // "." is appended to the end of java.library.path. Yes, this
578 // could cause a change in behavior, but Apple's Java6 behavior
579 // can be achieved by putting "." at the beginning of the
580 // JAVA_LIBRARY_PATH environment variable.
581 {
582 char *t = ld_library_path;
583 // that's +3 for appending ":." and the trailing '\0'
584 ld_library_path = (char *) malloc(strlen(t) + 3);
585 sprintf(ld_library_path, "%s:%s", t, ".");
586 free(t);
587 }
588 #endif
589
571 Arguments::set_library_path(ld_library_path); 590 Arguments::set_library_path(ld_library_path);
572 } 591 }
573 592
574 /* 593 /*
575 * Extensions directories. 594 * Extensions directories.