feat():测试

yuan
yuan 2024-09-06 01:11:57 +08:00
parent 769faff8eb
commit 4190277076
2 changed files with 3 additions and 18 deletions

View File

@ -62,7 +62,7 @@ public class FilesCompilerLoad {
try { try {
// class文件路径 // class文件路径
String externalClassFilePath = "/home/lib/com/muyu/generate/"+fileName+ MethodSuffix.CLASSSUFFIX; String externalClassFilePath = "/home/lib/com/muyu/generate/"+fileName;
log.info(externalClassFilePath); log.info(externalClassFilePath);
Path path = Paths.get(externalClassFilePath); Path path = Paths.get(externalClassFilePath);
@ -74,7 +74,7 @@ public class FilesCompilerLoad {
// 加载类 // 加载类
// 注意类名必须是完全限定名(包括包名) // 注意类名必须是完全限定名(包括包名)
Class<?> clazz = externalClassLoader.loadClassFromPath(path, "/home/lib/com/muyu/generate/"+fileName+ MethodSuffix.CLASSSUFFIX); Class<?> clazz = externalClassLoader.loadClassFromPath(path, "/home/lib/com/muyu/generate/"+fileName);
System.out.println(clazz); System.out.println(clazz);
} catch (MalformedURLException e) { } catch (MalformedURLException e) {

View File

@ -131,24 +131,9 @@ public class OSSFileLoad {
ossClient.shutdown(); ossClient.shutdown();
} }
} }
//对路径里的.java文件进行编译 //对路径里的.class文件进行编译
System.out.println("执行编译"); System.out.println("执行编译");
FilesCompilerLoad.classLoad(fileName); FilesCompilerLoad.classLoad(fileName);
// SourceCodeCompiler.javaCompilerPath("home/");
// System.out.println("第二步");
// File outputDir = new File("home/"); // 或者是你指定的其他输出目录
// System.out.println("第三步");
// File[] classFiles = outputDir.listFiles(); // 获取输出目录中的所有文件
// if (classFiles != null) {
// for (File classFile : classFiles) {
// if (classFile.getName().endsWith(".class")) {
// System.out.println("找到class文件 " + classFile.getName());
//// 把.class文件存入oss中
// }
// }
// }else {
// System.out.println("没有找到文件");
// }
return Result.success(source); return Result.success(source);
} }