read « PropertyFile « Java I/O Q&A





1. Can't read the content of a property file by using the relative path    stackoverflow.com

My java class is residing in the folder /webserver/tomcat-instance/webapps/shop/WEB-INF/classes/com/mobile/commons but the actual property file is residing in the location /webserver/tomcat-instance/webapps/shop/WEB-INF/classes/resources directory. Now in my java file i put the relative path ...

2. Null Pointer exception while reading the property file in WAS-5    coderanch.com

We have installed our J2EE enterprise application on WAS 5 recently. While reading form a property file, I always get a Null Pointer exception. The property file is defientely there in the proper path and with proper permissions. (The same code works fine in WebSphere 4.0.6 environment). This is the error I am getting on WebSphere 5 server: [2/21/05 20:15:58:786 GMT] ...

3. reading from property file    coderanch.com

Hi guys! I sincerely hope that someone can help me. I am trying to use property file and my code looks like package test.alex; import java.util.*; import java.io.*; public class Main { public Main() { try{ Properties prop = new Properties(); File f = new File(getClass().getResource("test.properties").toURI()); FileInputStream inS = new FileInputStream(f); prop.load(inS); System.out.println(prop.getProperty("user")); } catch(Exception exp){ exp.printStackTrace(); } } public static ...

5. Problem Reading Property File    coderanch.com

Translation: u = you pl = please y = why clasess = classes Please reduce the use of contractions. When you combine accidental spelling and grammar mistakes with people from around the world who may not have English as their primary language, contractions just make posts harder to understand and should be avoided. The point is well made though: if it ...

6. NullPointer Exception when reading property file    coderanch.com

Hi All, I am running my application in WebSphere 3.5. I am loading one of my servlet called "NotifierServlet" at the startup.. its throwing following exception. I am attaching my code of the servlet also. [04.08.20 08:22:59:218 EDT] 5cb5da4d WebGroup X Root Cause java.lang.NullPointerException at java.io.Reader.(Reader.java:68) at java.io.InputStreamReader.(InputStreamReader.java:88) at java.io.InputStreamReader.(InputStreamReader.java:77) at java.util.Properties.load(Properties.java:179) at com.alliedholdings.dashboard.notifier.NotifierServlet.init(Unknown Source) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at com.ibm.servlet.engine.webapp.StrictServletInstance.doInit(ServletManager.java:622) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._init(StrictLifecycleServlet.java:136) ...

8. reading a property file    coderanch.com

hello, i'm looking for a pattern to read a custom property file. it seems as if my current design has a principle problems: - i have a class PropertyReader which reads the file and adds it to the system properties propFile = new FileInputStream("application.properties"); Properties p = new Properties(System.getProperties()); p.load(propFile); System.setProperties(p); this code is called from a static initalizer block, a ...

9. How to read property file    coderanch.com

Hi all, I am working on already developed project. I have to provide localization for French language. I have proerty file for English. When I add another file in french and build the code it picks up english file as default file. How can I make locale selection dynamic so that it will also work in french. Another issue: Here is ...





10. Property file can't be read    java-forums.org

I am facing an exception when i am trying to create a connection to database.I have all the database connection strings in the database.property file .Is there anything to change in my code java.io.FileNotFoundException: database.properties (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(Unknown Source) at java.io.FileInputStream.(Unknown Source) at com.jpmc.efs.tcrr.pillar.release2.JavaPoller.getCo nnection(JavaPoller.java:41) at com.jpmc.efs.tcrr.pillar.release2.JavaPoller.main( JavaPoller.java:97). Code: public static Connection ...

11. How to read an integer constant from a property file    forums.oracle.com

Hello All I have to pick a value from the property file which is in the update field, the property file looks some wht like this Update = MAS_KMN_KSJKLP MAS_KMN_KSJKLP this is an integer cconstant defined in one of the jar files When i read this from property file i am getting it in the form of a string, I am ...

12. How to read an integer constant from a property file    forums.oracle.com

I have to pick a value from the property file which is in the update field, the property file looks some wht like this Update = MAS_KMN_KSJKLP MAS_KMN_KSJKLP this is an integer cconstant defined in one of the jar files When i read this from property file i am getting it in the form of a string, I am unable to ...

13. How to read an integer constant from a property file    forums.oracle.com

Hello All I have to pick a value from the property file which is in the update field, the property file looks some wht like this Update = MAS_KMN_KSJKLP MAS_KMN_KSJKLP this is an integer cconstant defined in one of the jar files When i read this from property file i am getting it in the form of a string, I am ...

15. How to read and update the property file    forums.oracle.com

Load the properties using an inputstream Call setProperty for each property you need to change Call store using an outputstream Give it a try (I assume you know how to Google to find examples for Input and Output Streams, since I have the feeling you can't do those, yet either, although why you would then be doing web applications when you ...





17. Character '\' is lost when reading a String from a property file.    forums.oracle.com

Hi all, I have encrypted information inside a property file, but when loading properties in my program, the String object used to store the value is changed by the lost of all \ characters # EIS password saved in the property file password=WPLqQE0DlVF8Sg\=\= #Value loaded in my String object WPLqQE0DlVF8Sg== Why is this happening? I use java.util.Properties java class to store ...

18. reading froma property file    forums.oracle.com

Hi, I have a property file with the following in it: #Macro RBSs 2TU + 2 MP boards RBSTYPE.MACRO=RBS3101,RBS3106,RBS3202,RBS3202 #OMNI RBSs 1TU + 1 MP boards RBSTYPE.OMNI=RBS3104,RBS3203,RBS303,RBS3107,RBS3402 #CBU RBSs 1TU/MP board RBSTYPE.CBU=RBS3107,RBS3412,RBS3512,RBS3206M,RBS3308,RBS3418,RBS3518,RBS3018,RBS3116,RBS3216 I am trying to display these in a drop-down menu, with MACRO first, then OMNI & then CBU, so the UI looks like: RBS3101 RBS3106 RBS3202 RBS3202 RBS3104 etc........ ...