how to specify options when using JavaCompiler interface
Ja开发者_开发技巧vaCompiler compiler = ToolProvider.getSystemJavaCompiler();
compiler.run(null, null, null, "cp", System.getProperties().getProperty("java.class.path"), sourceFile.getPath());
this not work, how to pass classpath option to JavaCompiler instance ?
You need to precede the argument with '-' i.e. -cp
or -classpath
as if you would use the command line javac. See also javac
精彩评论