Tabnine Logo
System.load
Code IndexAdd Tabnine to your IDE (free)

How to use
load
method
in
java.lang.System

Best Java code snippets using java.lang.System.load (Showing top 20 results out of 3,060)

origin: netty/netty

/**
 * Delegate the calling to {@link System#load(String)} or {@link System#loadLibrary(String)}.
 * @param libName - The native library path or name
 * @param absolute - Whether the native library will be loaded by path or by name
 */
public static void loadLibrary(String libName, boolean absolute) {
  if (absolute) {
    System.load(libName);
  } else {
    System.loadLibrary(libName);
  }
}
origin: fengjiachun/Jupiter

public static void load(String filename) {
  System.load(filename);
}
origin: redisson/redisson

/**
 * Delegate the calling to {@link System#load(String)} or {@link System#loadLibrary(String)}.
 * @param libName - The native library path or name
 * @param absolute - Whether the native library will be loaded by path or by name
 */
public static void loadLibrary(String libName, boolean absolute) {
  if (absolute) {
    System.load(libName);
  } else {
    System.loadLibrary(libName);
  }
}
origin: fengjiachun/Jupiter

public static void load(String filename) {
  System.load(filename);
}
origin: wildfly/wildfly

/**
 * Delegate the calling to {@link System#load(String)} or {@link System#loadLibrary(String)}.
 * @param libName - The native library path or name
 * @param absolute - Whether the native library will be loaded by path or by name
 */
public static void loadLibrary(String libName, boolean absolute) {
  if (absolute) {
    System.load(libName);
  } else {
    System.loadLibrary(libName);
  }
}
origin: libgdx/libgdx

/** @return null if the file was extracted and loaded. */
private Throwable loadFile (String sourcePath, String sourceCrc, File extractedFile) {
  try {
    System.load(extractFile(sourcePath, sourceCrc, extractedFile).getAbsolutePath());
    return null;
  } catch (Throwable ex) {
    return ex;
  }
}
origin: redisson/redisson

/**
 * Load a native library of snappy-java
 */
private synchronized static void loadNativeLibrary()
{
  if (!isLoaded) {
    try {
      nativeLibFile = findNativeLibrary();
      if (nativeLibFile != null) {
        // Load extracted or specified snappyjava native library.
        System.load(nativeLibFile.getAbsolutePath());
      } else {
        // Load preinstalled snappyjava (in the path -Djava.library.path)
        System.loadLibrary("snappyjava");
      }
    }
    catch (Exception e) {
      e.printStackTrace();
      throw new SnappyError(SnappyErrorCode.FAILED_TO_LOAD_NATIVE_LIBRARY, e.getMessage());
    }
    isLoaded = true;
  }
}
origin: libgdx/libgdx

private boolean loadLibrary (String sharedLibName) {
  if (sharedLibName == null) return false;
  String path = extractLibrary(sharedLibName);
  if (path != null) System.load(path);
  return path != null;
}
origin: eclipsesource/J2V8

static boolean load(final String libName, final StringBuffer message) {
  try {
    if (libName.indexOf(SEPARATOR) != -1) {
      System.load(libName);
    } else {
      System.loadLibrary(libName);
    }
    return true;
  } catch (UnsatisfiedLinkError e) {
    if (message.length() == 0) {
      message.append(DELIMITER);
    }
    message.append('\t');
    message.append(e.getMessage());
    message.append(DELIMITER);
  }
  return false;
}
origin: libgdx/libgdx

/** @return null if the file was extracted and loaded. */
private Throwable loadFile (String sourcePath, String sourceCrc, File extractedFile) {
  try {
    System.load(extractFile(sourcePath, sourceCrc, extractedFile).getAbsolutePath());
    return null;
  } catch (Throwable ex) {
    return ex;
  }
}
origin: libgdx/libgdx

private boolean loadLibrary (String sharedLibName) {
  if (sharedLibName == null) return false;
  String path = extractLibrary(sharedLibName);
  if (path != null) System.load(path);
  return path != null;
}
origin: koral--/android-gif-drawable

/**
 * Utilizes the regular system call to attempt to load a native library. If a failure occurs,
 * then the function extracts native .so library out of the app's APK and attempts to load it.
 * <p/>
 * <strong>Note: This is a synchronous operation</strong>
 */
@SuppressLint("UnsafeDynamicallyLoadedCode") //intended fallback of System#loadLibrary()
static void loadLibrary(Context context) {
  synchronized (ReLinker.class) {
    final File workaroundFile = unpackLibrary(context);
    System.load(workaroundFile.getAbsolutePath());
  }
}
origin: iBotPeaches/Apktool

public static void load(String libPath) {
  if (mLoaded.contains(libPath)) {
    return;
  }
  File libFile;
  try {
    libFile = getResourceAsFile(libPath);
  } catch (BrutException ex) {
    throw new UnsatisfiedLinkError(ex.getMessage());
  }
  System.load(libFile.getAbsolutePath());
}
origin: stackoverflow.com

 private static void loadLib(String path, String name) {
 name = System.mapLibraryName(name); // extends name with .dll, .so or .dylib
 try {
    InputStream in = ACWrapper.class.getResourceAsStream("/"+path + name);
    File fileOut = new File("your lib path");
    OutputStream out = FileUtils.openOutputStream(fileOut);
    IOUtils.copy(in, out);
    in.close();
    out.close();
    System.load(fileOut.toString());//loading goes here
  } catch (Exception e) {
        //handle
  }
}
origin: stackoverflow.com

 public static void loadJarDll(String name) throws IOException {
  InputStream in = MyClass.class.getResourceAsStream(name);
  byte[] buffer = new byte[1024];
  int read = -1;
  File temp = File.createTempFile(name, "");
  FileOutputStream fos = new FileOutputStream(temp);

  while((read = in.read(buffer)) != -1) {
    fos.write(buffer, 0, read);
  }
  fos.close();
  in.close();

  System.load(temp.getAbsolutePath());
}
origin: aragozin/jvm-tools

private static void load(File tmp, String arch) throws IOException {
  InputStream is = SjkWinHelper.class.getClassLoader().getResourceAsStream("sjkwinh.prop");
  Properties prop = new Properties();
  prop.load(is);
  
  String dllName = "sjkwinh" + arch + "." + prop.getProperty("dll" + arch + ".hash") + ".dll";
  int len = Integer.valueOf(prop.getProperty("dll" + arch + ".len"));
  
  File tgt = new File(tmp, dllName);
  if (tgt.isFile() && tgt.length() == len) {
    // dll is present
  }
  else {
    tgt.delete();
    InputStream dllis = SjkWinHelper.class.getClassLoader().getResourceAsStream("sjkwinh" + arch + ".dll");
    byte[] buf = new byte[len];
    int n = dllis.read(buf);
    if (n != buf.length) {
      throw new RuntimeException("Failed extract dll, size mismatch");
    }
    FileOutputStream fos = new FileOutputStream(tgt);
    fos.write(buf);
    fos.close();
  }
  
  System.load(tgt.getPath());
}
origin: libgdx/libgdx

/** Extracts the source file and calls System.load. Attemps to extract and load from multiple locations. Throws runtime
 * exception if all fail. */
private void loadFile (String sourcePath) {
  String sourceCrc = crc(readFile(sourcePath));
  String fileName = new File(sourcePath).getName();
  // Temp directory with username in path.
  File file = new File(System.getProperty("java.io.tmpdir") + "/libgdx" + System.getProperty("user.name") + "/" + sourceCrc,
    fileName);
  Throwable ex = loadFile(sourcePath, sourceCrc, file);
  if (ex == null) return;
  // System provided temp directory.
  try {
    file = File.createTempFile(sourceCrc, null);
    if (file.delete() && loadFile(sourcePath, sourceCrc, file) == null) return;
  } catch (Throwable ignored) {
  }
  // User home.
  file = new File(System.getProperty("user.home") + "/.libgdx/" + sourceCrc, fileName);
  if (loadFile(sourcePath, sourceCrc, file) == null) return;
  // Relative directory.
  file = new File(".temp/" + sourceCrc, fileName);
  if (loadFile(sourcePath, sourceCrc, file) == null) return;
  // Fallback to java.library.path location, eg for applets.
  file = new File(System.getProperty("java.library.path"), sourcePath);
  if (file.exists()) {
    System.load(file.getAbsolutePath());
    return;
  }
  throw new GdxRuntimeException(ex);
}
origin: libgdx/libgdx

/** Extracts the source file and calls System.load. Attemps to extract and load from multiple locations. Throws runtime
 * exception if all fail. */
private void loadFile (String sourcePath) {
  String sourceCrc = crc(readFile(sourcePath));
  String fileName = new File(sourcePath).getName();
  // Temp directory with username in path.
  File file = new File(System.getProperty("java.io.tmpdir") + "/libgdx" + System.getProperty("user.name") + "/" + sourceCrc,
    fileName);
  Throwable ex = loadFile(sourcePath, sourceCrc, file);
  if (ex == null) return;
  // System provided temp directory.
  try {
    file = File.createTempFile(sourceCrc, null);
    if (file.delete() && loadFile(sourcePath, sourceCrc, file) == null) return;
  } catch (Throwable ignored) {
  }
  // User home.
  file = new File(System.getProperty("user.home") + "/.libgdx/" + sourceCrc, fileName);
  if (loadFile(sourcePath, sourceCrc, file) == null) return;
  // Relative directory.
  file = new File(".temp/" + sourceCrc, fileName);
  if (loadFile(sourcePath, sourceCrc, file) == null) return;
  // Fallback to java.library.path location, eg for applets.
  file = new File(System.getProperty("java.library.path"), sourcePath);
  if (file.exists()) {
    System.load(file.getAbsolutePath());
    return;
  }
  throw new GdxRuntimeException(ex);
}
origin: libgdx/libgdx

public static void init () {
  if (initialized) return;
  // Need to initialize bullet before using it.
  if (Gdx.app.getType() == ApplicationType.Desktop && customDesktopLib != null) {
    System.load(customDesktopLib);
  } else
    Bullet.init();
  Gdx.app.log("Bullet", "Version = " + LinearMath.btGetVersion());
  initialized = true;
}
origin: Tencent/tinker

  tinker.getLoadReporter().onLoadFileMd5Mismatch(library, ShareConstants.TYPE_LIBRARY);
} else {
  System.load(patchLibraryPath);
  TinkerLog.i(TAG, "loadLibraryFromTinker success:" + patchLibraryPath);
  return true;
java.langSystemload

Javadoc

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.

Popular methods of System

  • currentTimeMillis
    Returns the current time in milliseconds. Note that while the unit of time of the return value is a
  • getProperty
    Returns the value of a particular system property. The defaultValue will be returned if no such prop
  • arraycopy
  • exit
  • setProperty
    Sets the value of a particular system property.
  • nanoTime
    Returns the current timestamp of the most precise timer available on the local system, in nanosecond
  • getenv
    Returns the value of the environment variable with the given name, or null if no such variable exist
  • getProperties
    Returns the system properties. Note that this is not a copy, so that changes made to the returned Pr
  • identityHashCode
    Returns an integer hash code for the parameter. The hash code returned is the same one that would be
  • getSecurityManager
    Gets the system security interface.
  • gc
    Indicates to the VM that it would be a good time to run the garbage collector. Note that this is a h
  • lineSeparator
    Returns the system's line separator. On Android, this is "\n". The value comes from the value of the
  • gc,
  • lineSeparator,
  • clearProperty,
  • setOut,
  • setErr,
  • console,
  • loadLibrary,
  • setSecurityManager,
  • mapLibraryName

Popular in Java

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • Menu (java.awt)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now