JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
compiler.run(null, null, null, "cp", System.getProperties().getProperty("java.class.path"), sourceFile.getPath());这不起作用,如何将类路径选项传递给JavaCompiler实例?
发布于 2011-10-09 16:23:17
您需要在参数前面加上'-‘,即-cp或-classpath,就像使用命令行javac一样。另请参阅javac
https://stackoverflow.com/questions/7702203
复制相似问题