测试编译class文件
parent
5aaf596214
commit
b0530eec22
|
@ -9,7 +9,7 @@ import javax.tools.ToolProvider;
|
|||
public class JavaClass {
|
||||
public static Result<Object> compile(String fileName) {
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
String[] strings = {"-classpath", "/home/lib", "-verbose", "-d", "/home/lib", fileName};
|
||||
String[] strings = {"-classpath", "/home/lib", "-verbose", "-d", "/home/lib", fileName+".java"};
|
||||
int result = compiler.run(null, null, null, strings);
|
||||
if (result == 0) {
|
||||
System.out.println("编译成功,生成的.class文件位于源代码同目录");
|
||||
|
|
Loading…
Reference in New Issue