java.lang.Runtime.load()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(190)

本文整理了Java中java.lang.Runtime.load()方法的一些代码示例,展示了Runtime.load()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Runtime.load()方法的具体详情如下:
包路径:java.lang.Runtime
类名称:Runtime
方法名:load

Runtime.load介绍

[英]Loads and links the dynamic library that is identified through the specified path. This method is similar to #loadLibrary(String), but it accepts a full path specification whereas loadLibrary just accepts the name of the library to load.
[中]加载并链接通过指定路径标识的动态库。此方法类似于#loadLibrary(String),但它接受完整路径规范,而loadLibrary只接受要加载的库的名称。

代码示例

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the path of the file to be loaded.
  9. */
  10. public static void load(String pathName) {
  11. Runtime.getRuntime().load(pathName, VMStack.getCallingClassLoader());
  12. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the absolute (platform dependent) path to the library to load.
  9. * @throws UnsatisfiedLinkError
  10. * if the library can not be loaded.
  11. */
  12. public void load(String pathName) {
  13. load(pathName, VMStack.getCallingClassLoader());
  14. }

代码示例来源:origin: EvoSuite/evosuite

  1. public static void load(Runtime runtime, String filename) {
  2. //load0(Reflection.getCallerClass(), filename);
  3. runtime.load(filename); // we need to load the actuall stuff
  4. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. public static void load(String filename) {
  2. Runtime.getRuntime().load(filename);
  3. }

代码示例来源:origin: MobiVM/robovm

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the path of the file to be loaded.
  9. */
  10. public static void load(String pathName) {
  11. Runtime.getRuntime().load(pathName, VMStack.getCallingClassLoader());
  12. }

代码示例来源:origin: FlexoVM/flexovm

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the path of the file to be loaded.
  9. */
  10. public static void load(String pathName) {
  11. Runtime.getRuntime().load(pathName, VMStack.getCallingClassLoader());
  12. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the path of the file to be loaded.
  9. */
  10. public static void load(String pathName) {
  11. Runtime.getRuntime().load(pathName, VMStack.getCallingClassLoader());
  12. }

代码示例来源:origin: com.bugvm/bugvm-rt

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the path of the file to be loaded.
  9. */
  10. public static void load(String pathName) {
  11. Runtime.getRuntime().load(pathName, VMStack.getCallingClassLoader());
  12. }

代码示例来源:origin: com.gluonhq/robovm-rt

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the path of the file to be loaded.
  9. */
  10. public static void load(String pathName) {
  11. Runtime.getRuntime().load(pathName, VMStack.getCallingClassLoader());
  12. }

代码示例来源:origin: com.oracle.substratevm/svm

  1. @Substitute
  2. public static void load(String filename) {
  3. // Substituted because the original is caller-sensitive, which we don't support
  4. Runtime.getRuntime().load(filename);
  5. }
  6. }

代码示例来源:origin: ibinti/bugvm

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the path of the file to be loaded.
  9. */
  10. public static void load(String pathName) {
  11. Runtime.getRuntime().load(pathName, VMStack.getCallingClassLoader());
  12. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the absolute (platform dependent) path to the library to load.
  9. * @throws UnsatisfiedLinkError
  10. * if the library can not be loaded.
  11. */
  12. public void load(String pathName) {
  13. load(pathName, VMStack.getCallingClassLoader());
  14. }

代码示例来源:origin: MobiVM/robovm

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the absolute (platform dependent) path to the library to load.
  9. * @throws UnsatisfiedLinkError
  10. * if the library can not be loaded.
  11. */
  12. public void load(String pathName) {
  13. load(pathName, VMStack.getCallingClassLoader());
  14. }

代码示例来源:origin: com.gluonhq/robovm-rt

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the absolute (platform dependent) path to the library to load.
  9. * @throws UnsatisfiedLinkError
  10. * if the library can not be loaded.
  11. */
  12. public void load(String pathName) {
  13. load(pathName, VMStack.getCallingClassLoader());
  14. }

代码示例来源:origin: ibinti/bugvm

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the absolute (platform dependent) path to the library to load.
  9. * @throws UnsatisfiedLinkError
  10. * if the library can not be loaded.
  11. */
  12. public void load(String pathName) {
  13. load(pathName, VMStack.getCallingClassLoader());
  14. }

代码示例来源:origin: FlexoVM/flexovm

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the absolute (platform dependent) path to the library to load.
  9. * @throws UnsatisfiedLinkError
  10. * if the library can not be loaded.
  11. */
  12. public void load(String pathName) {
  13. load(pathName, VMStack.getCallingClassLoader());
  14. }

代码示例来源:origin: com.bugvm/bugvm-rt

  1. /**
  2. * Loads and links the dynamic library that is identified through the
  3. * specified path. This method is similar to {@link #loadLibrary(String)},
  4. * but it accepts a full path specification whereas {@code loadLibrary} just
  5. * accepts the name of the library to load.
  6. *
  7. * @param pathName
  8. * the absolute (platform dependent) path to the library to load.
  9. * @throws UnsatisfiedLinkError
  10. * if the library can not be loaded.
  11. */
  12. public void load(String pathName) {
  13. load(pathName, VMStack.getCallingClassLoader());
  14. }

代码示例来源:origin: diffplug/goomph

  1. private void loadLibrary() {
  2. if (library != null) {
  3. try {
  4. if (library.indexOf("wpf") != -1) { //$NON-NLS-1$
  5. int idx = library.indexOf("eclipse_"); //$NON-NLS-1$
  6. if (idx != -1) {
  7. String comLibrary = library.substring(0, idx) + "com_"; //$NON-NLS-1$
  8. comLibrary += library.substring(idx + 8, library.length());
  9. Runtime.getRuntime().load(comLibrary);
  10. OleInitialize(0);
  11. }
  12. }
  13. Runtime.getRuntime().load(library);
  14. } catch (UnsatisfiedLinkError e) {
  15. //failed
  16. }
  17. }
  18. libraryLoaded = true;
  19. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.launcher

  1. private void loadLibrary() {
  2. if (library != null) {
  3. try {
  4. if (library.indexOf("wpf") != -1) { //$NON-NLS-1$
  5. int idx = library.indexOf("eclipse_"); //$NON-NLS-1$
  6. if (idx != -1) {
  7. String comLibrary = library.substring(0, idx) + "com_"; //$NON-NLS-1$
  8. comLibrary += library.substring(idx + 8, library.length());
  9. Runtime.getRuntime().load(comLibrary);
  10. OleInitialize(0);
  11. }
  12. }
  13. Runtime.getRuntime().load(library);
  14. } catch (UnsatisfiedLinkError e) {
  15. //failed
  16. }
  17. }
  18. libraryLoaded = true;
  19. }

代码示例来源:origin: org.opendaylight.tcpmd5/tcpmd5-jni

  1. private static void loadStream(final InputStream is) throws IOException {
  2. final Set<PosixFilePermission> perms = PosixFilePermissions.fromString("rwxr-x---");
  3. final Path p = Files.createTempFile(LIBNAME, null, PosixFilePermissions.asFileAttribute(perms));
  4. try {
  5. LOG.debug("Copying {} to {}", is, p);
  6. Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING);
  7. try {
  8. Runtime.getRuntime().load(p.toString());
  9. LOG.info("Library {} loaded", p);
  10. } catch (UnsatisfiedLinkError e) {
  11. throw new IOException(String.format("Failed to load library %s", p), e);
  12. }
  13. } finally {
  14. try {
  15. Files.deleteIfExists(p);
  16. } catch (IOException e) {
  17. LOG.warn("Failed to remove temporary file {}", p, e);
  18. }
  19. }
  20. }

相关文章