What is the fix for class file for com.google.common.base.predicate not found?

前端 未结 2 1517
鱼传尺愫
鱼传尺愫 2020-12-11 17:29

A sselenium program I have been developing for a while now comes up with com.google.common.base.Predicate not found when I open it in Netbeans. It appears

相关标签:
2条回答
  • 2020-12-11 18:11

    This class is part of the Guava library. It must be in your classpath. But libraries do not magically disappear from the classpath of a project when upgrading Java. Some one must have removed it.

    0 讨论(0)
  • 2020-12-11 18:21

    This class is normally located in a jar file called something like google-*.jar. Try to find it on your filesystem and if you do, make sure it is pointed to by the CLASSPATH environment variable (the variable should point to the jar file, not the directory which contains it). If you don't find it in your file system, you need to download it (it's free) and then ensure the correct CLASSPATH. Alternatively, you can use you system's package management tool to download it, in which case there is a chance it will update CLASSPATH automatically (you may need to log out and in again or restart you shell etc to make the last change effective).

    If you want to confirm the jar file you find/download contains the class, you can do something like this (Unix/Linux):

    jar -tf file.jar | grep 'com.google.common.base.Predicate'
    

    where you should substitute the name of the file you've found/downloaded for file.jar.

    0 讨论(0)
提交回复
热议问题