Example usage for weka.core Environment getVariableValue

List of usage examples for weka.core Environment getVariableValue

Introduction

In this page you can find the example usage for weka.core Environment getVariableValue.

Prototype

public String getVariableValue(String key) 

Source Link

Document

Get the value for a particular variable.

Usage

From source file:adams.core.management.WekaPackagesClassPathAugmenter.java

License:Open Source License

/**
 * Returns the classpath parts (jars, directories) to add to the classpath.
 * /*  w w w.  j a  v  a  2 s  . c om*/
 * @return      the additional classpath parts
 */
public synchronized String[] getClassPathAugmentation() {
    Environment env;
    String loadPackages;
    File[] contents;
    int i;
    Package toLoad;
    boolean load;

    m_Augmentations = new ArrayList<String>();

    // load packages?
    env = Environment.getSystemWide();
    loadPackages = env.getVariableValue("weka.core.loadPackages");
    if (loadPackages != null && loadPackages.equalsIgnoreCase("false"))
        return new String[0];

    // init packages
    WekaPackageManager.loadPackages(false);

    // try and load any jar files and add to the classpath
    contents = WekaPackageManager.PACKAGES_DIR.listFiles();
    for (i = 0; i < contents.length; i++) {
        if (contents[i].isDirectory()) {
            try {
                toLoad = WekaPackageManager.getInstalledPackageInfo(contents[i].getName());
                // Only perform the check against the current version of Weka if there exists 
                // a Description.props file
                if (toLoad != null) {
                    load = WekaPackageManager.loadCheck(toLoad, contents[i], System.err);
                    if (load)
                        loadPackageDirectory(contents[i]);
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                System.err.println("[WEKA] Problem loading package " + contents[i].getName() + " skipping...");
            }
        }
    }

    return m_Augmentations.toArray(new String[m_Augmentations.size()]);
}