开发者

how to specify options when using JavaCompiler interface

开发者 https://www.devze.com 2023-04-12 05:56 出处:网络
Ja开发者_开发技巧vaCompiler compiler = ToolProvider.getSystemJavaCompiler(); compiler.run(null, null, null, \"cp\", System.getProperties().getProperty(\"java.class.path\"), sourceFile.getPath());
 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号