Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-05-2008, 11:16 AM
Moderator
 
Join Date: Nov 2007
Posts: 1,637
Java Tip will become famous soon enoughJava Tip will become famous soon enough
How to store property file into key value pair
This example method use the Properties classes to load the property file. After extracting the property file the key value pair will add to the object of the Properties class.

Code:
import java.util.*; import java.io.*; public class LoadSample { public static void main(String args[]) throws Exception { Properties prop = new Properties(); FileInputStream fis = new FileInputStream("C:\\javaTips\\java.properties"); prop.load(fis); prop.list(System.out); System.out.println(prop.keySet()); System.out.println(prop.values()); System.out.println("\nThe java property: " + prop.getProperty("java")); } }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How would you get information from a file and then store it in an array? szimme101 Advanced Java 3 04-07-2008 07:02 PM
store file kazitula Java Applets 0 02-17-2008 10:45 PM
Initializing property object from a file Java Tip Java Tips 0 12-29-2007 05:55 PM
Property File Peter Database 2 07-04-2007 04:48 PM
log4j property file in my application Peter Advanced Java 3 06-14-2007 04:12 AM


All times are GMT +3. The time now is 09:57 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org