com.atlassian.bamboo.utils
Class JavaVirtualMachineDetector

java.lang.Object
  extended by com.atlassian.bamboo.utils.JavaVirtualMachineDetector

public class JavaVirtualMachineDetector
extends java.lang.Object

Based on comment from Vincent Massol on the forums: http://www.pols.co.uk/forums/viewtopic.php?id=26


Constructor Summary
JavaVirtualMachineDetector(boolean isRunningOnOsx)
           
 
Method Summary
 boolean containsJavac(java.io.File givenDirectory)
           
 boolean containsToolsJar(java.io.File givenDirectory)
           
 java.lang.String detectExternalJdkVersion(java.io.File givenDirectory)
           
 java.lang.String detectJavaHome(java.lang.String systemJavaHome)
          Used to detects if the default JAVA_HOME is running on a JRE and not a JDK (so that the tools.jar is missing and build's cannot compile).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaVirtualMachineDetector

public JavaVirtualMachineDetector(boolean isRunningOnOsx)
Method Detail

detectJavaHome

public java.lang.String detectJavaHome(java.lang.String systemJavaHome)
Used to detects if the default JAVA_HOME is running on a JRE and not a JDK (so that the tools.jar is missing and build's cannot compile).

The strategy is:

If not, return false, user has installed a JRA and not a JDK

Parameters:
systemJavaHome - What the system thinks the JAVA_HOME is - may be a JRE or a JVM!
Returns:
The JAVA_HOME adjusted to ensure we're running on JDK and not the JDK's JRE!
Throws:
java.lang.IllegalStateException - if we are running only on a JRE as we not be able to build any builds by default!

containsJavac

public boolean containsJavac(java.io.File givenDirectory)

containsToolsJar

public boolean containsToolsJar(java.io.File givenDirectory)

detectExternalJdkVersion

@Nullable
public java.lang.String detectExternalJdkVersion(java.io.File givenDirectory)


Copyright © 2011 Atlassian. All Rights Reserved.