1

I get an error when connecting to redis, first time I use 1 eclipse tab to connect and succeed then I open another eclipse tab and the same code and error,I have added jedis 3.1.0 library, and didn't add anything to java file,I do like this example:https://www.tutorialspoint.com/redis/redis_java.htm

Exception in thread "main" java.lang.NoClassDefFoundError: redis/clients/jedis/Jedis
    at Redisnew.conect.main(conect.java:9)
Caused by: java.lang.ClassNotFoundException: redis.clients.jedis.Jedis
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 1 more
  • Please, add a little bit more explanation of what you're trying to do and a listing of your `pom.xml`/ `build.gradle` file, if any – Denis Sep 27 '20 at 13:13
  • I have edited my post, can you please see it for me – ngoxuantien Sep 27 '20 at 14:41
  • The error is thrown because the `Jedis` class is not on the classpath. You wrote that you're using Eclipse, then [this](https://stackoverflow.com/questions/3280353/how-to-import-a-jar-in-eclipse) question should help you – Denis Sep 27 '20 at 14:46
  • Thank you very much, I am a novice so the question will be a bit difficult to understand, hope you sympathize – ngoxuantien Sep 27 '20 at 14:52
  • It's not so difficult, the problem is more or less clear. Did you try something from the question linked above? – Denis Sep 27 '20 at 15:02
  • the classpath it's a bit confusing for me, and I'm still learning about it – ngoxuantien Sep 27 '20 at 15:11
  • Thank you, it worked, great – ngoxuantien Sep 27 '20 at 22:20

0 Answers0