PageRenderTime 33ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/logback-1.0.6/logback-core/src/main/java/ch/qos/logback/core/util/EnvUtil.java

#
Java | 49 lines | 27 code | 6 blank | 16 comment | 5 complexity | 9f7b71270fc8b5839b0862d92363ac4d MD5 | raw file
  1. /**
  2. * Logback: the reliable, generic, fast and flexible logging framework.
  3. * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
  4. *
  5. * This program and the accompanying materials are dual-licensed under
  6. * either the terms of the Eclipse Public License v1.0 as published by
  7. * the Eclipse Foundation
  8. *
  9. * or (per the licensee's choosing)
  10. *
  11. * under the terms of the GNU Lesser General Public License version 2.1
  12. * as published by the Free Software Foundation.
  13. */
  14. package ch.qos.logback.core.util;
  15. /**
  16. * @author Ceki Gücü
  17. */
  18. public class EnvUtil {
  19. static public boolean isJDK5() {
  20. String javaVersion = System.getProperty("java.version");
  21. if (javaVersion == null) {
  22. return false;
  23. }
  24. if (javaVersion.startsWith("1.5")) {
  25. return true;
  26. } else {
  27. return false;
  28. }
  29. }
  30. static public boolean isJaninoAvailable() {
  31. ClassLoader classLoader = EnvUtil.class.getClassLoader();
  32. try {
  33. Class bindingClass = classLoader.loadClass("org.codehaus.janino.ScriptEvaluator");
  34. return (bindingClass != null);
  35. } catch (ClassNotFoundException e) {
  36. return false;
  37. }
  38. }
  39. public static boolean isWindows() {
  40. String os = System.getProperty("os.name");
  41. return os.startsWith("Windows");
  42. }
  43. }