Package com.atlassian.bamboo.utils
Class JavaVirtualMachineDetector
- java.lang.Object
-
- com.atlassian.bamboo.utils.JavaVirtualMachineDetector
-
public class JavaVirtualMachineDetector extends Object
Based on comment from Vincent Massol on the forums: http://www.pols.co.uk/forums/viewtopic.php?id=26
-
-
Constructor Summary
Constructors Constructor Description JavaVirtualMachineDetector(boolean isRunningOnOsx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsJavac(File givenDirectory)
@Nullable String
detectExternalJdkVersion(File givenDirectory)
String
detectJavaHome(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).
-
-
-
Method Detail
-
detectJavaHome
public String detectJavaHome(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 running on OSX, return the JAVA_HOME as no need for tools.jar on the mac
- First loot to see if we can find the tools.jar in ${java.home}/lib/tools.jar. If found then you've got your dir.
- Otherwise look for tools.jar in ${java.home}/../lib/tools.jar. if found then you've got your dir.
- 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:
IllegalStateException
- if we are running only on a JRE as we not be able to build any builds by default!
-
containsJavac
public boolean containsJavac(File givenDirectory)
-
-