# liquor **Repository Path**: bryan31/liquor ## Basic Information - **Project Name**: liquor - **Description**: noear:: Java 动态编译小工具 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 75 - **Created**: 2024-07-29 - **Last Updated**: 2025-02-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![Maven Central](https://img.shields.io/maven-central/v/org.noear/liquor.svg)](https://mvnrepository.com/search?q=g:org.noear%20AND%20liquor) [![Apache 2.0](https://img.shields.io/:license-Apache2-blue.svg)](https://license.coscl.org.cn/Apache2/) [![JDK-8+](https://img.shields.io/badge/JDK-8+-green.svg)](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html) [![QQ交流群](https://img.shields.io/badge/QQ交流群-22200020-orange)](https://jq.qq.com/?_wv=1027&k=kjB5JNiC) # Liquor for java Java dynamic compilation tool. (This tool is compatible with jar in jar) The code of this tool mainly comes from Arthas. The relevant knowledge is relatively unpopular and precious, but it can only be used in appropriate scenes (it must not be abused). For the convenience of reuse, it is organized into a small toolkit for long-term maintenance. ### demo ```xml org.noear liquor 1.0.2 ``` ```java public class DemoApp { public static void main(String[] args) { String className = "com.demo.proxy.MyClass"; String classCode = "package com.demo.proxy;\n" + "\n" + "public class MyClass {\n" + "\n" + " public String say(String str){\n" + " return \"hello\"+str;\n" + " }\n" + "}"; DynamicCompiler compiler = new DynamicCompiler(); compiler.addSource(className, classCode); Map> classMap = compiler.build(); System.out.println(classMap.get(className)); } } ```