Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

BufferedReader Not Reading Text File

843785Dec 17 2008 — edited Dec 18 2008
I've got some code where I am trying to read a text file with BufferedReader so that I can read a list to pass a string to another piece of code. It will show me the first JOptionPane, but not the second.
import java.io.*;
import java.util.*;
import javax.swing.*;

  public void ReadFolders()
  {// Begin ReadFolders
	  String s=null;
	  try
	  {//Begin try block
		  //Read text file and place items in hash table
		  JOptionPane.showMessageDialog(null, "step 2");//GETS HERE
		  BufferedReader DB=new BufferedReader (new FileReader("C:\\folderName.txt"));
		  JOptionPane.showMessageDialog(null, "step 3");//DOES NOT GET HERE
		  while ((s=DB.readLine())!=null) //loop until out of lines in the text file
		  {
			  //put String tokens in hashtable
			  JOptionPane.showMessageDialog(null, "step 4");
			  CreateFolder(s);
			  JOptionPane.showMessageDialog(null, "step 5");
		  }//end while loop
		  DB.close();
	  }//end of try block
	  catch(IOException ioe){}
	  catch(NoSuchElementException ix){}
  }//end of ReadFolders
Any help will be appreciated.
Thank you,
Brian

Edited by: BrianT on Dec 17, 2008 11:56 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2009
Added on Dec 17 2008
16 comments
690 views