1 22 package org.aspectj.tools.ajdoc; 23 24 29 public class Main { 30 34 public static final int PLATFORM_ERROR = 3; 35 36 42 public static void main(String [] args) { 43 System.exit(execute(args)); 44 } 45 46 55 public static int execute(String [] args) { 56 int result = 0; 57 String platformError = platformErrorMessage(); 58 if (null != platformError) { 59 result = PLATFORM_ERROR; 60 System.err.println(platformError); 61 } else { 62 Ajdoc me = new Ajdoc(); 63 result = me.execute(args); 64 } 65 return result; 66 } 67 68 73 public static String platformErrorMessage() { 74 boolean failed = false; 76 final String [] versions = new String [] 77 { "java.lang.reflect.Proxy" }; 81 for (int i = 0; i < versions.length; i++) { 82 try { 83 Class.forName(versions[i]); 84 failed = (i == 1); 85 } catch (ClassNotFoundException cnfe) { 86 failed = (i == 0); 87 } catch (Error err) { 88 failed = (i == 0); 89 } 90 if (failed) { 91 String version = "(unknown version)"; 92 try { version = System.getProperty("java.version"); } 93 catch (Throwable t) { } return "Ajdoc requires J2SE 1.3; not java " + version; 95 } 96 } 97 try { 99 Class.forName("com.sun.javadoc.RootDoc"); Class.forName("com.sun.javadoc.Type"); } catch (ClassNotFoundException cnfe) { 102 return "Requires tools.jar from J2SE 1.3 (not 1.2 or 1.4) be on the class path"; 105 } catch (Error err) { return "Requires tools.jar from J2SE 1.3 (not 1.2 or 1.4) be on the class path"; 109 } 110 return null; 111 } 112 } 113 | Popular Tags |