I'm trying to make a class that calls certain instances of an object according to the value of my custom annotation, to it found that, Google Reflection is a good option but I can not instantiate it, what am I doing wrong?
I try
public class TesteDeAnotacoes {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Reflections reflections = new Reflections("testedeanotacoes.test");
}
}
and have the follow error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Predicate
at testedeanotacoes.TesteDeAnotacoes.main(TesteDeAnotacoes.java:26)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Predicate
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 1 more
Java Result: 1
my project
I missed some detail for it is not working?
This is clearly a dependencies issues, and it is orthogonal to any library.
The best solution is to use a decent build system, and get the transitive dependencies easily. Make sure to get familiar with Maven (or Gradle, SBT, ...), and take a look at the pom.xml, especially the dependencies section.
Other solution is to manually download the libraries needed and build the classpath (java -cp ...), or, if available, get a fat-jar which embeds all the dependencies.