Example usage for org.apache.commons.lang SystemUtils getJavaHome

List of usage examples for org.apache.commons.lang SystemUtils getJavaHome

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils getJavaHome.

Prototype

public static File getJavaHome() 

Source Link

Document

Gets the Java home directory as a File.

Usage

From source file:org.codehaus.mojo.keytool.ImportMojoTest.java

public void testRunOKImportJRECaCerts() throws MojoExecutionException {
    mojo.setFile("certsfile");
    mojo.setUseJREcacerts(true);//ww w. j  a  v a2s  .com
    File cacertsFile = new File(SystemUtils.getJavaHome() + "/" + "lib/security/cacerts");

    mojo.execute();

    String[] expectedArguments = { "-import", "-noprompt", "-file", "certsfile", "-keystore",
            cacertsFile.getAbsolutePath(), "-keypass", "secretpassword", "-storepass", "secretpassword2" };

    checkMojo(expectedArguments);
}

From source file:org.codehaus.mojo.keytool.KeyToolMojoSupport.java

/**
 * Constructs the operating system specific File path of the JDK command given the specified command name.
 * @param command the executable name //from  ww w .  j  a va2s  . c  o  m
 * @return a File representing the path to the command.
 */
public static File getJDKCommandExe(String command) {
    String fullCommand = command + (SystemUtils.IS_OS_WINDOWS ? ".exe" : "");

    File exe;

    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        exe = new File(SystemUtils.getJavaHome() + "/../sh", fullCommand);
    } else if (SystemUtils.IS_OS_MAC_OSX) // what about IS_OS_MAC_OS ??
    {
        exe = new File(SystemUtils.getJavaHome() + "/bin", fullCommand);
    } else {
        exe = new File(SystemUtils.getJavaHome() + "/../bin", fullCommand);
    }

    return exe;
}

From source file:org.codehaus.mojo.keytool.KeyToolMojoSupport.java

/**
 * Constructs the operating system specific File path of the JRE cacerts file.
 * @param command the executable name //from  w w  w  . j  a  va  2  s .c o m
 * @return a File representing the path to the command.
 */
public static File getJRECACerts() {

    File cacertsFile = null;

    String cacertsFilepath = "lib/security/cacerts";

    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    } else if (SystemUtils.IS_OS_MAC_OSX) // what about IS_OS_MAC_OS ??
    {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    } else {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    }

    return cacertsFile;

}

From source file:org.codehaus.mojo.keytool.KeyToolUtil.java

/**
 * Constructs the operating system specific File path of the JRE cacerts file.
 *
 * @return a File representing the path to the command.
 *//*from www.j a  v a2 s  . c  om*/
public static File getJRECACerts() {

    File cacertsFile;

    String cacertsFilepath = "lib" + File.separator + "security" + File.separator + "cacerts";

    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    } else if (SystemUtils.IS_OS_MAC_OSX) // what about IS_OS_MAC_OS ??
    {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    } else {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    }

    return cacertsFile;
}

From source file:org.jetbrains.jet.completion.confidence.JetConfidenceTest.java

@Override
protected Sdk getProjectJDK() {
    return JavaSdk.getInstance().createJdk("JDK", SystemUtils.getJavaHome().getAbsolutePath());
}

From source file:org.jetbrains.jet.completion.JetCompletionTestBase.java

protected static Sdk getFullJavaJDK() {
    return JavaSdk.getInstance().createJdk("JDK", SystemUtils.getJavaHome().getAbsolutePath());
}

From source file:org.jetbrains.jet.plugin.JetWithJdkAndRuntimeLightProjectDescriptor.java

@Override
public Sdk getSdk() {
    return JavaSdk.getInstance().createJdk("JDK", SystemUtils.getJavaHome().getAbsolutePath());
}