Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-24-2007, 12:09 AM
Member
 
Join Date: Nov 2007
Posts: 13
Feng is on a distinguished road
JFileChooser/Scanner/openFileReader
i want to make a dialog box to import a file and then use the buffered reader to use it. should i use (before the BufferedReader) the JFileChooser, the Scanner or the openFileReader? i tried to use all of them but i always got problems that i cant solve.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-24-2007, 12:22 AM
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
If you are using a gui a JFileChooser is an easy way to get a reference to a user–selected file. If using a console application you can use a JOptionPane to receive user input and pass the file path off to your BufferedReader.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-24-2007, 01:25 AM
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
Code:
BufferedReader br = null;
The reader is null. A NullPointerException is thrown when you attempt to access something that is null.
Code:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 11-24-2007, 01:47 AM
Member
 
Join Date: Nov 2007
Posts: 13
Feng is on a distinguished road
i had to initialize it thats why I typed null.
i want to use the JOptionPane.
anyway thanx for your reply.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 11-24-2007, 04:49 PM
Member
 
Join Date: Nov 2007
Posts: 1
chester is on a distinguished road
hallo
Hi guy, I'm new in java. I hope this forum will make every body know java.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 11-24-2007, 06:31 PM
Member
 
Join Date: Nov 2007
Posts: 13
Feng is on a distinguished road
Quote:
Originally Posted by chester View Post
Hi guy, I'm new in java. I hope this forum will make every body know java.
This forum is for introductions http://www.java-forums.org/introductions/
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
JFileChooser example (selecting a directory) Java Tip Java Tips 0 03-14-2008 02:02 PM
Localize JFileChooser Java Tip Java Tips 0 03-14-2008 01:54 PM
JFileChooser remember the location Mr tuition AWT / Swing 3 12-08-2007 07:17 PM
how to use JFileChooser tommy New To Java 1 08-06-2007 10:49 PM
help with IP scanner tommy New To Java 1 08-06-2007 10:00 PM


All times are GMT +3. The time now is 03:57 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org