• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

including ini file in project

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the properties classes and this will allow you to load from a file url or from the classpath.
 
T Tberg
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
T Tberg
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the file is only in the project so I assume it doesn't automatically put it in the classpath...
 
reply
    Bookmark Topic Watch Topic
  • New Topic