Home > Mobile >  Gradle package jdk.internal.org.objectweb.asm not exists
Gradle package jdk.internal.org.objectweb.asm not exists

Time:03-08

jdk 1.8.0_201 gradle 6.9.2

compileJava{
    options.compilerArgs  = '-XDignore.symbol.file'
    options.fork = true
}
or
tasks.withType(JavaCompile){
    configure(options){
        options.compilerArgs  = "-XDignore.symbol.file"
        //options.compilerArgs.add("-XDignore.symbol.file")
        options.fork = true
        options.verbose = true
    }

dependencies {
    implementation files("${System.properties['java.home']}/lib/rt.jar")
    implementation files("${System.properties['java.home']}/lib/jce.jar")
    implementation files("${System.properties['java.home']}/lib/jsse.jar")
}
public class HelloDump implements Opcodes {
    public static byte[] dump(){
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
        cw.visit(V1_8, ACC_PUBLIC|ACC_SUPER, "nx.example.asm", null, "java/lang/Object",null);
        ......
        cw.visitEnd();

        return cw.toByteArray();
    }
}

BUILD SUCCESSFUL in 1s but run main method get error:package jdk.internal.org.objectweb.asm not exists

CodePudding user response:

tasks.withType(JavaCompile){
configure(options){
    options.compilerArgs.add("-XDignore.symbol.file=true")
    options.fork = true
    options.forkOptions.executable = 'javac'
    options.encoding = 'utf-8'
}

}

  • Related