Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

selenium

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 that some Java update has removed or changed that library. Does it have to be reinstalled or is there some replacement for it?

like image 270
vfclists Avatar asked Feb 03 '23 12:02

vfclists


2 Answers

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.

like image 107
JB Nizet Avatar answered Mar 22 '23 23:03

JB Nizet


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.

like image 40
Adam Zalcman Avatar answered Mar 22 '23 22:03

Adam Zalcman