I have built jFairy project from git repository ([1]: https://github.com/Devskiller/jfairy.git) using mvnw install command. then I have imported compiled jar file to my project.
package userdao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.ResultSet;
import com.devskiller.jfairy.Fairy;
import com.devskiller.jfairy.producer.person.Person;
import userdao.User;
/**
*
* @author loveu
*/
public class UserDao {
/**
* @param args the command line arguments
* @throws java.lang.ClassNotFoundException
* @throws java.sql.SQLException
*/
public static void main(String[] args) throws ClassNotFoundException, SQLException {
UserDao dao = new UserDao();
User user = new User();
Fairy fairy = Fairy.create();
Person person = fairy.person();
user.setId(person.getFullName());
user.setName(person.getFirstName());
user.setPassword(person.getEmail());
dao.add(user);
System.out.println(user.getId() + "successfuly");
User user2 = dao.get(user.getId());
System.out.println(user2.getName());
System.out.println(user2.getPassword());
// TODO code application logic here
}
but while compiling, currently I have got that error
run: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/inject/AbstractModule at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at com.devskiller.jfairy.Fairy.create(Fairy.java:54) at userdao.UserDao.main(UserDao.java:29) Caused by: java.lang.ClassNotFoundException: com.google.inject.AbstractModule at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 14 more C:\Users\loveu\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
How to fix that. Thanks