Reputation: 59491
I'm getting a error
java.lang.ClassNotFoundException: com.google.common.net.InternetDomainName
when trying to run the following code:
private String getTopPrivateDomain(String url) {
return InternetDomainName.from(url).topPrivateDomain().toString();
}
I have downloaded guava-18.0.jar
and I have triple-checked that it exists in my build-path. I have also imported com.google.common.net.*
. I get no errors or warnings in Eclipse and the program compiles fine, but it throws the above exception when the method is run.
I don't understand why it cannot find that class when it's clearly imported and in the build-path?
Upvotes: 1
Views: 526
Reputation: 20063
The jar isn't in the classpath location when it's being ran, but it is configured in Eclipse. If you're using Tomcat or something like that it'll need to be in a /lib directory
Upvotes: 1