aspose file tools*
The moose likes Beginning Java and the fly likes Config.ini Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Config.ini" Watch "Config.ini" New topic
Author

Config.ini

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

May I know where can I find the config.ini file in the computer directories?

Because I want to write a program which can find all the details of databse and dsn details etc... using properties class.

So please tell me where can i find it.

REgards,

Rahul Roy


and my programme is like this.
import java.io.*;
import java.util.*;
public class PropLoadTest
{
public static void main(String a[])
{


try{

Properties prop= new Properties();
FileInputStream fis = new

FileInputStream("Config.ini");
//this is where i am getting the problems
prop.load(fis);

fis.close();

String dbDsn = prop.getProperty("dsn");
String dbName = prop.getProperty("name");

System.out.println(dbDsn);
System.out.println(dbName);

} catch(Exception e)
{
e.printStackTrace();

}

}

}
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824

The config.ini file that you are referencing would have to be in the same directory as the directory from which you launched the java application. if it's not there, you will have to specify the path to where your config.ini is.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

Is this a file you authored or was created on the computer all ready? If you authored it then you can put it wherever you'd like depending on your needs. For example, if this was a network server and administrators needed a way to change this file remotely, you might place it on a shared drive and tell the server to search there.

Its up to you to decide where to place it to best fit the needs of your application. On the other hand if this is not a file you wrote, we'll need more specifics on what program created it.


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Config.ini