简体   繁体   中英

java.lang.NoClassDefFoundError while trying to implement Cloner

So I'm attempting to deep copy some custom objects using the Cloner library. I was able to get the code typed out without errors and the import working, but the moment it runs it gives me a NoClassDefFoundError: sun.reflect.ReflectionFactory at org.objenesis.instantiator.

So basically, it's failing to recognize the cloner library for some reason. I cannot figure this out. I found this thread but it is getting old and has no answer as of yet. NoClassDefFoundError when using objenesis on Android

Any help would be very much appreciated.

When we compile java source, we end up with .class files for each class in our program. These binary files are the bytecode that Java interprets to execute your program. The NoClassDefFoundError indicates that the classloader, which is responsible for dynamically loading classes, cannot find the .class file for the class that you're trying to use.

It probably indicates that you haven't set the classpath option when executing your code. Try setting the classpath when you execute.

Hope this helps.. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM