Пример #1
0
def check_jdk_version():
  """
  Check preinstalled JDK versions
  C5.5.x:
    1.7.0_55 (min)
    1.8.0_31 (min) (note: JDK 1.8.0_40 is not recommended)
    'javac -version' writes to stderr
  """
  args = ['javac', '-version']
  result, stdout, stderr = subprocess_with_timeout(args, 10)
  LOG.debug('javac -version: %s', stderr.rstrip())

  if stderr.startswith('javac'):
    v = stderr[6:].rstrip()
    r = v.split('_')[0]
    u = v.split('_')[1]

    if r not in JDK.keys():
      LOG.error("Running unsupported version of JDK: '%s'. %s", v, LOG_JDK)
    elif int(u) < JDK[r]:
      LOG.error("Running unsupported update of JDK: '%s'. %s", v, LOG_JDK)
    elif v is '1.8.0_40':
      LOG.error("Running known bad version of JDK: '%s'. %s", v, LOG_JDK)
    else:
      LOG.info("Running supported version of JDK: '%s'" % v)
Пример #2
0
def check_hotspot():
  """
  Check for preinstalled Oracle Java
  'java -version' writes to stderr
  """
  args = ['java', '-version']
  result, stdout, stderr = subprocess_with_timeout(args, 10)
  LOG.debug('java -version:\n%s', stderr.rstrip())
  if stderr.startswith('java'):
    # Check for Oracle Java
    if 'HotSpot' not in stderr:
      LOG.error("Running unsupported Java implementation. %s", LOG_JDK)
    else:
      LOG.info('Running supported Java implementation (Oracle)')