Two Laptop Bag*
The moose likes Java in General and the fly likes Help with Properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Help with Properties file" Watch "Help with Properties file" New topic
Author

Help with Properties file

Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
Apparently Properties file is not meant to be read dynamically. In other words, I cannot go through a directory and create Properties files basd on available files that have attribute=value format.
Pleass, could someone show me the way on how to go about doing the above. I need to read values from files and upload them onto table.

Thanks.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

try the load() method:

hth,
Junilu
[This message has been edited by JUNILU LACAR (edited October 16, 2001).]


Junilu - [How to Ask Questions] [How to Answer Questions]
Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
I am using the load method but the execution doesn't make it that far. The funnier (or more upsetting) thing is that it sees the file but then it throws FileNotFoundException and sometimes NullPointerException on my face.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

Med,
Post some code and we'll see if we can get to the bottom of this.
Junilu
Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
I've tried making this as short as possible: Let me know if you need more.
Appreciate you guys looking into this.
dataFile is of type String, that's what getFileWithExtension returns.
ICONFEED is of Properties type.
Program does not makes it beyond the while.
.
.
.
while ((dataFile = getFileWithExtension(dirPath, fileExt))!= null )
{
if (dataFile == null)
System.out.println(dataFile + "not found!");
System.out.println("File: " + dataFile);
FileInputStream fisdat = new FileInputStream(dataFile);
boolean Renresult = copyFile(dirPath,logDir);
System.out.println("Moving" + dataFile);

ICONFEED.load(fisdat);
System.out.println("Loaded " + fisdat);
System.out.println("Processing: " + dataFile);
("Reading dataFile " + dataFile);
System.out.println("Reading properties");
Feed = ICONFEED.getProperty("FEED");
}
System.out.println("No more files to process!");
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help with Properties file
 
Similar Threads
Applet Security
.ini file in Web App Environment
Reading Properties files into table
How to read a description of a file
Reading files