All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sangupta.jerry.util.JDKUtils Maven / Gradle / Ivy

package com.sangupta.jerry.util;

/**
 * Utility functions around the JDK
 * 
 * @author sangupta
 *
 */
public class JDKUtils {
	
	/**
	 * Check if JDK version is 1.7 or not
	 * 
	 * @return true if version is 1.7, false otherwise
	 */
	public static boolean isJDK7() {
		String version = System.getProperty("java.version");
		if(version.startsWith("1.7")) {
			return true;
		}
		
		return false;
	}
	
	/**
	 * Check if we are running under OracleJDK
	 * 
	 * @return true if VM vendor is Oracle, false
	 *         otherwise
	 */
	public static boolean isOracleJDK() {
		String name = System.getProperty("java.vm.name");
		name = name.toLowerCase();
		if(name.contains("java hotspot(tm)")) {
			return true;
		}
		
		return false;
	}
	
	/**
	 * Check if we are running under OpenJDK
	 * 
	 * @return true if VM vendor is OpenJDK, false
	 *         otherwise
	 */
	public static boolean isOpenJDK() {
		String name = System.getProperty("java.vm.name");
		name = name.toLowerCase();
		if(name.contains("openjdk")) {
			return true;
		}
		
		return false;
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy