Пример #1
0
  /**
   * Adds the CPLEX library path specified in the user preferences {@see
   * setCPLEXLibraryPath(String)}
   */
  public static boolean setup() {

    FilePreference pref = DomainPreferences.getInstance().getPreference("CPLEX_LIBRARY_PATH");
    String path = pref.get().getPath();

    List<String> paths =
        Arrays.asList(System.getProperty("java.library.path").split(File.pathSeparator));

    if (path != null && !path.isEmpty() && pref.get().exists()) {

      try {
        if (paths.contains(path)) {
          return true;
        }
        LOGGER.info("Configuring library cplex path " + path);
        addLibraryPath(path);
        return true;
      } catch (IOException ex) {
        LOGGER.error("Unable to add CPLEX library path " + path + " to 'java.libary.path'");
      }
    }

    return false;
  }
Пример #2
0
 /**
  * Sets the CPLEX library path in the preferences and calls {@see setup()} adding this to the
  * system property library paths. Note: No paths are not removed
  */
 public static void setCPLEXLibraryPath(String path) {
   FilePreference pref = DomainPreferences.getInstance().getPreference("CPLEX_LIBRARY_PATH");
   pref.put(new File(path));
   setup();
 }