Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

including ini file in project  RSS feed

 
Ranch Hand
Posts: 44
  • 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
 
Ranch Hand
Posts: 166
  • 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
  • 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
 
Bartender
Posts: 9481
12
Linux Mac OS X Windows
  • 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
  • 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...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!