Hi I have to make a program to parse html document and check for broken links.
I did the first part and now wondering is there a method or class that checks if the link is valid?if not I assumed I can construst a method myself, like get the response code and see if 200.

Any help appreciated.
thanks.

by the way I found this http://commons.apache.org/validator/apidocs/org/apache/commons/validator/UrlValidator.html
but when I tried to compile I got
checkUrl.java:91: cannot find symbol
symbol : class UrlValidator
location: class checkUrl
UrlValidator urlValidator = new UrlValidator();

org.apache.commons.validator
Class UrlValidator

java.lang.Object
extended by org.apache.commons.validator.UrlValidator

All Implemented Interfaces:
java.io.Serializable

I would suggest importing the package, and also downloading the appropriate jar file

I imported java.lang.Object

and where and what jar package i should download?

why would you import Object?
your class can use that no matter what, since it's the base-class of everything in Java.

org.apache.commons.validator
Class UrlValidator

java.lang.Object
extended by org.apache.commons.validator.UrlValidator

All Implemented Interfaces:
java.io.Serializable

you need to import the package in which UrlValidator is found, so you can use it. it's the jar file in which this class is you need to download

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.