1
0
Fork
You've already forked InMemoryJavaCompiler
0
Utility class to compile java source code in memory
Java 100%
Find a file
Nguyen Kien Trung d84c404975
Update README.md
2017年11月13日 09:15:30 -05:00
src merged with turpid-monkey/master with some minor refactoring 2017年09月26日 21:29:31 -04:00
.gitignore gitignore 2017年09月23日 23:12:53 -04:00
.travis.yml code coverage with codecov 2017年10月09日 21:28:24 -04:00
LICENSE Create LICENSE 2016年09月09日 09:40:20 +08:00
pom.xml code coverage with codecov 2017年10月09日 21:27:23 -04:00
README.md Update README.md 2017年11月13日 09:15:30 -05:00

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 Build Status codecov FOSSA Status

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

FOSSA Status