Newer
Older
SyntaxEditor / InMemJavaC.java
@motoki miura motoki miura on 7 Nov 2022 551 bytes first commit
package info.istlab.SyntaxEditor;

import org.mdkt.compiler.InMemoryJavaCompiler;

public class InMemJavaC {

    public InMemJavaC(String src){
            Class<?> helloClass;
            try {
               helloClass = InMemoryJavaCompiler.newInstance().compile("Hello", src );
               System.out.println(helloClass.getClass().getName());

               System.out.println(helloClass.getDeclaredConstructor().newInstance().toString());
            } catch (Exception e1) {
               e1.printStackTrace();
            }

    }
    
}