The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Reading INI file into the application

Posted by David Hwang on April 12, 2000 at 3:55 PM


I have an application which reads in different properties from an INI file. However when I move the application to another platform, the directory name for the INI file needs to be changed.

For example, in Windows I would have

RandomAccessFile raf = new RandomAccessFile("c:\app\hello.ini", "r");

and on Unix it will become

RandomAccessFile raf = new RandomAccessFile("/usr/local/app/hello.ini", "r");

It is troublesome to change the code to reflect the directory change. Is there a way to put the file in the CLASSPATH and load it?

Thanks for your help!


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us