Unit Testing


To test the File Search application:

  1. Set the path of the bin directory of J2SDK by executing the following command at the command prompt:

     set path=%path%;D:\j2sdk1.4.0_02\bin; 
  1. Set the classpath of the lib directory of J2SDK by executing the following command at the command prompt:

     set classpath = %classpath%;d:\j2sdk1.4.0_02\lib; 
  1. Copy the Search.java, FileList.java, and Help.java files to a folder on your computer. Next, compile the files using the javac command as follows :

     javac *.java 
  1. To run the File Search application, specify the following command at the command prompt:

     java Search 
  1. Click the Browse button on the File Search Utility window to specify the location where you want to search for files.

  2. Specify a text string in the Containing text box to limit your search to those files that contain this text pattern.

  3. Click the Search button to start the file search process. The File Search Utility window with the search results appears, as shown in Figure 4-4:

    click to expand: this figure shows the file search utility window displaying the results of a file search.
    Figure 4-4: The File Search Utility Window with File Search Results

The right pane of the window shows the name and size of 974 files that are located within the C:\Test folder and contain the text string, java. The window also displays the start positions of the text pattern, java, in these 974 files.




Java InstantCode. Developing Applications Using Java NIO
Java InstantCode. Developing Applications Using Java NIO
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 55

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net