< prev index next >

jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java

Print this page




 123             // print usage and abort.
 124             System.out.println(e.getMessage());
 125             System.out.println();
 126             usage();
 127             return -1;
 128         }
 129 
 130         Class schemagenRunner = classLoader.loadClass(Runner.class.getName());
 131         Method compileMethod = schemagenRunner.getDeclaredMethod("compile",String[].class,File.class);
 132 
 133         List<String> aptargs = new ArrayList<String>();
 134 
 135         if (options.encoding != null) {
 136             aptargs.add("-encoding");
 137             aptargs.add(options.encoding);
 138         }
 139 
 140         aptargs.add("-cp");
 141         aptargs.add(setClasspath(options.classpath)); // set original classpath + jaxb-api to be visible to annotation processor
 142 
 143         aptargs.add("-addmods");
 144         aptargs.add("java.xml.bind");
 145 
 146         if(options.targetDir!=null) {
 147             aptargs.add("-d");
 148             aptargs.add(options.targetDir.getPath());
 149         }
 150 
 151         aptargs.addAll(options.arguments);
 152 
 153         String[] argsarray = aptargs.toArray(new String[aptargs.size()]);
 154         return ((Boolean) compileMethod.invoke(null, argsarray, options.episodeFile)) ? 0 : 1;
 155     }
 156 
 157     private static String setClasspath(String givenClasspath) {
 158         StringBuilder cp = new StringBuilder();
 159         appendPath(cp, givenClasspath);
 160         ClassLoader cl = Thread.currentThread().getContextClassLoader();
 161         while (cl != null) {
 162             if (cl instanceof URLClassLoader) {
 163                 for (URL url : ((URLClassLoader) cl).getURLs()) {




 123             // print usage and abort.
 124             System.out.println(e.getMessage());
 125             System.out.println();
 126             usage();
 127             return -1;
 128         }
 129 
 130         Class schemagenRunner = classLoader.loadClass(Runner.class.getName());
 131         Method compileMethod = schemagenRunner.getDeclaredMethod("compile",String[].class,File.class);
 132 
 133         List<String> aptargs = new ArrayList<String>();
 134 
 135         if (options.encoding != null) {
 136             aptargs.add("-encoding");
 137             aptargs.add(options.encoding);
 138         }
 139 
 140         aptargs.add("-cp");
 141         aptargs.add(setClasspath(options.classpath)); // set original classpath + jaxb-api to be visible to annotation processor
 142 
 143         aptargs.add("--add-modules");
 144         aptargs.add("java.xml.bind");
 145 
 146         if(options.targetDir!=null) {
 147             aptargs.add("-d");
 148             aptargs.add(options.targetDir.getPath());
 149         }
 150 
 151         aptargs.addAll(options.arguments);
 152 
 153         String[] argsarray = aptargs.toArray(new String[aptargs.size()]);
 154         return ((Boolean) compileMethod.invoke(null, argsarray, options.episodeFile)) ? 0 : 1;
 155     }
 156 
 157     private static String setClasspath(String givenClasspath) {
 158         StringBuilder cp = new StringBuilder();
 159         appendPath(cp, givenClasspath);
 160         ClassLoader cl = Thread.currentThread().getContextClassLoader();
 161         while (cl != null) {
 162             if (cl instanceof URLClassLoader) {
 163                 for (URL url : ((URLClassLoader) cl).getURLs()) {


< prev index next >