我的test
包中有两个类:Bean
,Demo2
和VerboseLoader
。
Bean.java
:
package test;
public class Bean {
}
VerboseLoader.java
:
package test;
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.NotFoundException;
import javassist.Translator;
public class VerboseLoader implements Translator{
@Override
public void start(ClassPool pool) throws NotFoundException, CannotCompileException {
}
@Override
public void onLoad(ClassPool pool, String classname) throws NotFoundException, CannotCompileException {
System.out.println("onLoad called for " + classname);
}
}
Demo2.java
:
package test;
import javassist.*;
public class Demo2{
public static void main(String[] args) throws Throwable {
if(args.length >= 1){
Translator translator = new VerboseLoader();
ClassPool pool = ClassPool.getDefault();
Loader loader = new Loader(pool);
loader.addTranslator(pool, translator);
String[] pargs = new String[args.length-1];
System.arraycopy(args, 1, pargs, 0, pargs.length);
loader.run(args[0], pargs);
}
else{
System.out.println("Main args...");
}
}
}
会抛出
onLoad called for Bean
Exception in thread "main" java.lang.ClassNotFoundException: Bean
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at javassist.Loader.delegateToParent(Loader.java:431)
at javassist.Loader.loadClass(Loader.java:311)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at javassist.Loader.run(Loader.java:284)
at test.Demo2.main(Demo2.java:21)
[Javassist 3.23.1-GA]
我在做什么错了?
答案 0 :(得分:0)
我错过了className之前的软件包名称
.attribute-swatch .swatchinput {
display: block !important;
float: none !important;
}