File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

including ini file in project

 
Niels Tielenburg
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm trying to store some settings in an ini file but all I can manage so far is for example to read and write from an ini file from my desktop.
is it possible to include an ini file in a project and then read and write from it?
i'm using netbeans and i did manage to get an ini file in a project but i didn't manage how to read and write from it...

thanks in advance
 
Jeremy Wilson
Ranch Hand
Posts: 166
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the properties classes and this will allow you to load from a file url or from the classpath.
 
Niels Tielenburg
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm trying this:

but I think it can't find Inloggegevens.ini because it gives an null pointer exception, but the Inloggegevens.ini file is deffinitly in the project
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Niels Tielenburg wrote:but the Inloggegevens.ini file is deffinitly in the project


Is the file in the classpath? ClassLoader.getSystemResource() is going to look in the classpath for the file, so if it is not accessible, you'll get a null from that call.
 
Niels Tielenburg
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the file is only in the project so I assume it doesn't automatically put it in the classpath...
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic