Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

Properties

Thread view: 
Marcin Go³dyn - 19 Jun 2005 23:42 GMT
Hi
I have a properties file access.properties and i try to add something to
this empty file. I use this code :
Properties properties = new Properties();
   try {
         properties.load(new FileInputStream("access.properties"));
       } catch (IOException e) {
        System.out.println(e.getMessage());
       }

properties.setProperty("/db","1");

try {
       properties.store(new FileOutputStream("access.properties"), null);
   } catch (IOException e) {
    System.out.println(e.getMessage());
   }

but it isnt work file is still empty 0 exceptions why??
Marcin Goldyn
david bydefault - 19 Jun 2005 23:57 GMT
> but it isnt work file is still empty 0 exceptions why??
> Marcin Goldyn

Are you using a IDE? If you are compiling and running from the console,
it should work. Otherwise, maybe you are not looking at the folder where
the IDE runs the code.
Wendy Smoak - 20 Jun 2005 00:03 GMT
> I have a properties file access.properties and i try to add something to
> this empty file. I use this code :
>
> but it isnt work file is still empty 0 exceptions why??

Your code worked fine for me.  Where is your access.properties file located?
Are you sure you have write permission down to the directory and on the file
itself?

Signature

Wendy Smoak

Marcin Go³dyn - 20 Jun 2005 09:33 GMT
Hi
I`m stupid. Of course file is stored in my main IDE catalog.
forgive me this post. Thx for your advices and attention.
Marcin Goldyn


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.