Skip to content

xiaoheng1/online-exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

online-exec

Java在线编译器

1.实现对框架中提供的工具类的自动加载,例如如果动态编译的代码块对其他类有调用,但是该类还没有被编译,那么会自动的加载其他依赖类. 2.对输入输出流进行了封装,屏蔽一些危险的操作,例如 System.exit(-1); 等. 3.实现对输入文本进行编译,获取结果.

说一个 Spring Boot 的 TomcatEmbeddedWebappClassLoader 的坑吧.

当在浏览器上访问 http://localhost:8080/index 时出在提交编译代码的界面,但是处理提交需要编译代码的时候,发现 TomcatEmbeddedWebappClassLoader 扫描的 urls 为空,导致我设置 StandardJavaFileManager.location 为空,进而一直报无法加载 onlineexec.common.ExecSystem 该类.

解决办法:在设置 StandardJavaFileManager.location 判断 classLoader 的 urls 是否为空,如果为空,则跳过设置.

About

Java在线编译器

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published