InMemoryJavaCompiler
Utility class to compile java source code in memory
Install / Use
/learn @trung/InMemoryJavaCompilerREADME
Update 09/22/2017: I've been silent for long time (I'm into Golang lately hence putting Java aside) despite the fact that there are lots of interests to make this mini tool better. I'll kick off my effort to improve this tool from now on by reviewing outstanding issues and PRs
InMemoryJavaCompiler

Samples with utility classes to compile java source code in memory
After taking huge effort to look for example on the internet and found nothing work. I decided to create a very simple version.
Note: Please make sure you use JDK in your runtime
E.g.:
StringBuilder sourceCode = new StringBuilder();
sourceCode.append("package org.mdkt;\n");
sourceCode.append("public class HelloClass {\n");
sourceCode.append(" public String hello() { return \"hello\"; }");
sourceCode.append("}");
Class<?> helloClass = InMemoryJavaCompiler.newInstance().compile("org.mdkt.HelloClass", sourceCode.toString());
If you are looking for more examples, please look at unit tests in the src/test/java folder
Artifact is pushed to Sonatype OSS Releases Repository
https://oss.sonatype.org/content/repositories/releases/
Maven dependency:
<dependency>
<groupId>org.mdkt.compiler</groupId>
<artifactId>InMemoryJavaCompiler</artifactId>
<version>1.3.0</version>
</dependency>
License
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
