# Access Properties-Files

**URL:** <https://techcommunity.softwareag.com/t/access-properties-files/57159>\
**Category:** Forum\
**Tags:** Former-Crossvision-Products, Application-Composer\
**Created:** [January 30, 2006, 9:32pm UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159 "2006-01-30T21:32:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![J111](https://avatars.discourse-cdn.com/v4/letter/j/50afbb/32.png) [@J111](https://techcommunity.softwareag.com/u/J111)\
**Post date:** [January 30, 2006, 9:32pm UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159/1 "2006-01-30T21:32:58Z")

</div>

Hi,  
i want to access a property-file from an adapter-class.  
Now i get this file with an FileInputStream. But every time i get an FileNotFoundException although the property-file stored in cis\WEB-INF\classes or cis\PROJECTNAME\appclasses\classes.

Can anyone help me?

Thanks

---

<div class="post-metadata">

**Author:** ![Bjoern\_Mueller](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@Bjoern\_Mueller](https://techcommunity.softwareag.com/u/Bjoern_Mueller)\
**Post date:** [January 30, 2006, 10:54pm UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159/2 "2006-01-30T22:54:32Z")

</div>

…could you show some code the code? Do you load the file by classloader or by file i/o?

Bjoern

---

<div class="post-metadata">

**Author:** ![J111](https://avatars.discourse-cdn.com/v4/letter/j/50afbb/32.png) [@J111](https://techcommunity.softwareag.com/u/J111)\
**Post date:** [January 31, 2006, 12:54pm UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159/3 "2006-01-31T12:54:32Z")

</div>

ok here is an example coding:

…  
Properties properties = new Properties();  
properties.load(new FileInputStream(“beispiel.properties”));  
String sprache = properties.getProperty(“lang”);  
…

You see i load the file by i/o. Is it possible to load the file by classloader? Can you give me an example?

thanks

J

---

<div class="post-metadata">

**Author:** ![Bjoern\_Mueller](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@Bjoern\_Mueller](https://techcommunity.softwareag.com/u/Bjoern_Mueller)\
**Post date:** [January 31, 2006, 1:25pm UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159/4 "2006-01-31T13:25:49Z")

</div>

Hi J

---

<div class="post-metadata">

**Author:** ![J111](https://avatars.discourse-cdn.com/v4/letter/j/50afbb/32.png) [@J111](https://techcommunity.softwareag.com/u/J111)\
**Post date:** [January 31, 2006, 1:55pm UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159/5 "2006-01-31T13:55:53Z")

</div>

Hi Bjoern,  
thanks. With the classloader it works fine. But how can i load the file if i store it in a directory like …\tomcat\webapps\cis\myProject\config or somewhere else in my webapp.

J

---

<div class="post-metadata">

**Author:** ![Bjoern\_Mueller](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@Bjoern\_Mueller](https://techcommunity.softwareag.com/u/Bjoern_Mueller)\
**Post date:** [January 31, 2006, 11:47pm UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159/6 "2006-01-31T23:47:28Z")

</div>

J

---

<div class="post-metadata">

**Author:** ![J111](https://avatars.discourse-cdn.com/v4/letter/j/50afbb/32.png) [@J111](https://techcommunity.softwareag.com/u/J111)\
**Post date:** [February 1, 2006, 12:59am UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159/7 "2006-02-01T00:59:59Z")

</div>

Hi Bjoern,  
i can not find a method like … Parameters.getApplicationDirectoryName(“yourproject”) . Please can you give me a little example coding?

Thanks,  
J

---

<div class="post-metadata">

**Author:** ![Bjoern\_Mueller](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@Bjoern\_Mueller](https://techcommunity.softwareag.com/u/Bjoern_Mueller)\
**Post date:** [February 1, 2006, 12:41pm UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159/8 "2006-02-01T12:41:28Z")

</div>

…sorry, the class was com.softwareag.cis.server.Params…

```
/**
 * Each CIS project is represented by an own directory inside the Web-
 * Application. The directory is directly located under the Web-Application directory.
 * <br><br>
 * Example: the web application may look like...:<br>
 * webAppXYZ/casabac/.... <== some casabac directories<br>
 * webAppXYZ/cisdemos/... <== the demos project<br>
 * webAppXYZ/HTMLBasedGUI/... <== the CIS-own project<br>
 * webAppXYZ/project1/... <== application project<br>
 * webAppXYZ/project2/... <== application project<br>
 * webAppXYZ/WEB-INF/...<br>
 * webAppXYZ/META-INF/...<br>
 */
public static String getApplicationDirectoryName(String application) 

```

…but as I said: pay attention to servlet container restrictions. We access the function “ServletContext.getRealPath(”“);” which is an optional function according to J2EE spec.

Bjoern

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:38pm UTC](https://techcommunity.softwareag.com/t/access-properties-files/57159/9 "2021-04-02T14:38:26Z")

</div>


