TH ("Test Hyperlinks") v. 1.1b

by Dmitrii N. Rassokhin

Contents

  1. Abstract
  2. Overview
  3. License
  4. Installation
  5. Usage
  6. How to contact the author

Abstract

TH is a hyperlink validator. It opens an HTML file on a local disk, searches it for hyperlinks to remote World Wide Web sites, tries to connect to each one found, and writes a report on each failed attempt directly into the file examined (as an HTML-comment). TH is very fast, because of its capability of concurrently checking many links. TH is a console Java application; it can run on any computer with Java Virtual Machine compatible with Sun Microsystems JDK 1.1.1 or later installed.

Overview

Have you ever tried to maintain HTML pages containing many links (aka hyperlinks or hyperreferences) to other Web sites? If your answer is "yes", then you will agree that fixing the links that have become invalid since you added them to the page is quite a chore. A whole bunch of utilities have already been written to help you track down such bad links, and TH is yet another such utility. It reads an HTML file from a local disk, finds all the <a href="http://hostname/filename"> tags in it, tries to connect to each hostname, and reports each attempt's results. However, TH has a number of features making it especially useful to the experienced web author/designer:

License

TH is freeware (of course, I don't mind it if you send me a check for a few bucks, but I don't really think TH' users' donations are going to make me rich). Use TH on your own risk. Respect the author's rights. Feel free to re-distribute it on a non-commercial basis as it is, with this th-docs.html file attached. TH's source code is available for $100 upon request, if you are not going to re-destribute it (contact the author).

Installation

  1. Download Sun Micorsystems JDK (Java Development Kit) 1.1.1 or later for your computer platform/operating system and install it according to the instructions in the README file accompanying the JDK package. You can download JDK from the following sites: NOTE: On WinNT/95 platforms you can also use a JDK 1.1-compatible Java machine from Microsoft. By the way, installing JDK will allow you to run not only TH, but also other Java applications. As the number of Java applications on the market is growing fast, having JDK installed on your computer is a good idea, even though you are not going to become a Java programmer.
  2. Create classes sub-directory (aka "folder") under the directory at which the JDK is installed. For example, if on a PC with Microsoft Windows 95 JDK is installed at c:\jdk1.1.1, then c:\jdk1.1.1\classes should be created (if it does not yet exist).
  3. Unpack the th1.1b.zip file into the classes directory with any unzip utility capable of handling long file names. The directory structure stored in the zip file should be restored. Having unzipped the file, you will find th-docs.html (this file), TH.class and th.ico in the classes directory, and several *.class files in the classes\thinternal sub-directory.
  4. Try to run TH. Type java TH and press Enter (on a Windows 95/NT computer you should open an MS-DOS window first; if you are using Microsoft's Java, type jview TH instead of java TH). If it is installed correctrly, TH will output a few lines of help text. If both JDK, and TH are installed properly, you will be able to run TH from any directory. If it is not the case, refer to the JDK's documentation. NOTE: you may install TH in any directory other than recommended above and set the CLASSPATH accordingly (or run TH from the directory where the TH.class is placed). Refer to the JDK's documentation to find info on setting CLASSPATH.
  5. You can write a batch file (under Win NT/95) or a shell script (under UNIX) to run java TH with the options you prefer. The icon file th.ico is included with the TH package so you can assign the icon to the batch file running TH.

Usage

java [java-options] TH [-fd] [-th:nn] [-to:xxx] [filename]

NOTE: If you are using Microsoft's Java, type jview instead of java.

The command-line parameters enclosed in the [] are optional.

While TH is running, it writes a progress report to the standard output device, i.e., to the console, if the output is not redirected. After it finishes the job normally, it saves the original HTML file as filename.TH.bak, and writes reports on all failed hyperlinks directly into filename, the HTML file examined. Each report is timestamped and placed as a <!--...--> comment right after the corresponding hyperlink tag so you can easily locate and fix the wrong links later. An example of such a comment is shown below:

<A HREF="http://jchemed.chem.wisc.edu/DynaPub/DynaPub.html">
<!--TH (Fri Sep 19 05:19:29 PDT 1997): File not found.-->

If you want to stop TH, press Ctrl-C (if you're running it in a multi-window environment, make TH's console window active first). The Java Machine will terminate TH, and the original HTML file will be left intact.

TH returns a status code of 0 if no errors were found in the file tested, 1 if errors were found, and 10 or higher if the test could not be completed.

NOTE:To check an HTML file more thoroughly, it often makes sense to run TH on the same file more than once and compare older error reports with the newer ones, because some of the WWW servers reported unavailable can become available later, and vice versa.

How to contact the author

Dmitrii N. Rassokhin: dima@mch.chem.msu.su

Last revised: December 27, 1997

Sun, Sun Microsystems, and Java are trademarks of Sun Microsystems, Inc. Windows, Windows 95, and Windows NT are trademarks of Microsoft Corporation, Inc.