NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Reading text files in netbeans?

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
Ash2010



Joined: 24 Jan 2010
Posts: 1

PostPosted: Sun Jan 24, 2010 1:05 am    Post subject: Reading text files in netbeans? Reply with quote

I'm trying to read from a text file in netbeans using a basic java program, however my program cannot find the text file unless I specifically enter the directory it is stored in. When I put my text file in the same directory as the classes my program can't locate it. Where abouts am I supposed to put my text files in netbeans?
Back to top
sam3000



Joined: 27 Jan 2010
Posts: 1

PostPosted: Wed Jan 27, 2010 11:33 am    Post subject: Reply with quote

I too am trying to achieve this. When i program using Eclipse/Textpad its quite easy!
I found this site for netbeans so im going to try it and thought you might want to take a look at it!
http://capturevision.wordpress.com/2008/06/28/how-to-embed-resource-files-using-netbeans/
Back to top
Andy Knight
Posted via mailing list.





PostPosted: Wed Jan 27, 2010 2:25 pm    Post subject: Reading text files in netbeans? Reply with quote

In the properties of your Java project, you have the option to specify a Working Directory (Run).

Set that up and then you can use file / path names that are relative to that location.

Andy Knight
Principal Engineer,
Sun Microsystems, Inc.
Java House, Guillemont Park, Minley Road,
Camberley, Surrey GU17 9QG United Kingdom
Home office: +44 1494 462438
Mobile: +44 7775 583415
Skype: aprknight
Email: address-removed
Blog: http://blogs.sun.com/andky

On 24 Jan 2010, at 01:05, Ash2010 wrote:

Quote:
I'm trying to read from a text file in netbeans using a basic java program, however my program cannot find the text file unless I specifically enter the directory it is stored in. When I put my text file in the same directory as the classes my program can't locate it. Where abouts am I supposed to put my text files in netbeans?



Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo