Help required in reading properties file

Hi,
I have ApplicationResources.properties in one of my package say, aaa/bbb/ccc/ApplicationResources.properties
I need to read this from a Java main class located in another package aaa/bbb/ddd/Info.java
This is read to get the version details of the war file that is created by running in the command prompt.
ApplicationResources.properties is formed inside a jar file which is available in the war file. Because of this, I am not able to access the property file directly by running the war file.
Please help.

Robis-a_m wrote:
Because of this, I am not able to access the property file directly by running the war file.Because of what? If it is in the classpath, you should just be able to access it.
Where and how are you trying to access it then?

Similar Messages

  • Help required in reading a file from Shared location on Network

    Hi,
    I need help in reading a file from a shared location. Can you kindly tell me the pattern for inputting the shared location path. I am using fileUtilService>Exists
    "\\Shiva\test\shared\eForms\temp.xlsx" is the actual location of the file. How should i input the location in the INPUT variable of EXISTS.

    readResource content operation will fetch documents from Adobe Repository. Unless you checkin the required file into repository, the above error will remain.
    From a shared folder, you should able to read the files using readDocument (using FileUtils) without any issues. Perhaps, the access rights prevent the execution.
    If you are running JBoss as a windows service (turnkey will create a windows service for the JBoss instance), try the following:
    Run -> services.msc -> Right click on JBoss service for Adobe LiveCycle -> Properties
    Check the value given under logon tab. The User Account mentioned there should have appropriate access to the shared folder you are attempting read.
    Nith

  • How to read properties file(key-value) in OSB?

    Hi
    I have a scenario in which I have to read some properties(key-value) from a file. Earlier whole code was developed in java and its easy to read properties file in java.
    But now need to implement this in OSB and performance is very critical in this project.
    I followed DVM approached defined in
    http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html and http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html
    But it did not work. I have hundreds of properties(key-value pairs) to read and need pass them to the business service along with input of proxy service.
    What is the best approach for this (Can not go for db call as performance is very critical)?
    Thanks
    Vibhor

    $DVM= <dvm      name="InterfaceProperties" xmlns:ns1="http://xmlns.oracle.com/dvm" xmlns="http://xmlns.oracle.com/dvm">
         <columns>
         <column      name="PROPERTY_KEY" qualifier="false" order="1"/>
         <column      name="PROPERTY_VALUE" qualifier="false" order="1"/>
         </columns>
         <rows>
         <row>
         <cell>dealer.locate.default.buypower.link</cell>
         <cell>http://www.xyz.com</cell>
         </row>
         <row>
         <cell>dealer.locate.default.unitOfMeasure</cell>
         <cell>MILES</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.nu</cell>
         <cell>Nurun</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.bu</cell>
         <cell>Buick</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.ca</cell>
         <cell>Cadillac</cell>
         </row>
    </rows>
    </dvm>
    XPATH is- ns1:dvm/ns1:rows[1]/ns1:row[1]/ns1:cell[1]/text()
    If I run this xpath in Jdeveloper,its giving me proper output.
    Please this as CQuery resource and try to run this xpath on OSB console.
    Thanks
    Vibhor
    Edited by: Vibhor Rastogi on Sep 21, 2010 4:59 AM

  • Cannot read properties files in debug mode .....

    I am using JDeveloper 10g (10.1.3.0.4) and cannot seem to read properties files in debug mode, while it runs fine in Run (non debug) mode!!
    For code like this:
    Properties props = new Properties();
    String dbPropsFile = "/pol_main.properties";
    InputStream is;
    is = this.getClass().getResourceAsStream(dbPropsFile); <---- ERRORS HERE!
    props.load(is);
    I get error messages like:
    "Unable to find source file for package oracle.classloader, filename PolicyClassLoader.java".
    Cannot go any further.
    I am using the "hotspot" virtual machine under Project debug options. Using Sun's
    JDK 1.5 update 6 with Ojvm installed.
    Thanks.

    I think I figured out something. In jDeveloper 10.1.3, open your project properties and click on the Run/Debug treeview branch. Now Edit the Run Configuration you are using (mine is Default) and check the Run Directory. If I change this to be the root of my source, which is one level down from my .jpr file, it now uses my standard path and finds my files. I suppose you could also change this to use the classes directory as the root as long as your props files were there too. My problems seem to be the result of my project root being one folder higher than my source root due to the way our project was imported from CVS. --Ed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • The best way to read properties file

    Hi folks,
    The best way to read properties file i.e.. using ResourceBundle or FileInputStream . if so how to do it , my properties file is n WEB-INF/classes/myprop.properties.It's urgent.
    Thanks & Regards,
    Rajeshwar.

    WEB-INF/classes should be in your classpath. The web container takes care of that.
    All you have to do is call ResourceBundle.getBundle("myprop").
    It'll append the .properties for you.
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/ResourceBundle.html#getBundle(java.lang.String)

  • How to read Properties file once and access through the entire application

    HI All,
    I want to read properties file only once and want to access the property file values in entire application (like i want to access it in a ordinary class)

    Please do not double-post. Stick with one thread:
    http://forum.java.sun.com/thread.jspa?messageID=9678612

  • Help required in accessing a file on shared path

    Hi,
    I am trying to access a file present in a shared location using a custom component. When i run my Java code the file is accessible. But when i deploy the same code on livecycle as a custom component, the code is not able to access the file.
    The location of the file is as follows: \\Shiva\Test\tempExcel.xlsx
    The path string i use in Java code is: ////Shiva//Test//tempExcel.xlsx
    Can someone help me with this issue. Do i have to change the pattern of the file path when i am trying to access the file from adobe livecycle custom component?
    In case i need to provide permissions to livecycle for accessing the Excel sheet please suggest on how i should implement the same.

    readResource content operation will fetch documents from Adobe Repository. Unless you checkin the required file into repository, the above error will remain.
    From a shared folder, you should able to read the files using readDocument (using FileUtils) without any issues. Perhaps, the access rights prevent the execution.
    If you are running JBoss as a windows service (turnkey will create a windows service for the JBoss instance), try the following:
    Run -> services.msc -> Right click on JBoss service for Adobe LiveCycle -> Properties
    Check the value given under logon tab. The User Account mentioned there should have appropriate access to the shared folder you are attempting read.
    Nith

  • Error reading Properties file

    I have a main method which i am using to call a servlet located in the same Development Component. Until recently i had the servlet location hard coded and it was working without issues. Now i decided to make the location configurable. For this i created an sap.application.global.properties file in the EAR DC which contains the WAR of this DC.
    The contents of the above file are as follows:
    SAP application properties
    SERVLET.LOCATION=http://<server-name>/ControllerServlet/servlet/com.nike.xapps.eqptsp.swem.controller.ControllerServlet
    The code i am using in the main method to call this properties file and access the property is as follows:
    Context ctx = new InitialContext();
    ApplicationConfigHandlerFactory cfgHdlr = (ApplicationConfigHandlerFactory)ctx.lookup("ApplicationConfiguration");          
    Properties props = cfgHdlr.getApplicationProperties();
    String servlet = props.getProperty("SERVLET.LOCATION");
    contained in a try...catch block.
    On dubugging i get a NoInitialContextException repeatedly in the statement where the lookup is performed.
    These are all the additions i have made for reading this properties file. Does anyone know if there is anything more that needs to be done for this to work.
    Thanks,
    Murtaza.

    thank for the help mangst. i guess the IO approach is also applicable ^^; i changed my code to:
    configFile.load( new FileInputStream( ".\\resources\\config.properties" ) );but i had a little trouble in debugging it since it starts the file search from the main project directory. however it works fine upon deployment. ^^; thanks again.
    Edited by: xnofate on Sep 23, 2008 6:21 PM

  • Unable to read Properties file from Java code

    Hi,
    The directory structure of my application is as follows:-
    My App
    ++++++ src
    ++++++++com
    ++++++++++readProp.java
    ++++++++resource
    ++++++++++message.properties
    I am trying to read the file as follows:-
    <code>
    public Static final string FilePath="resource.message.properties"
    Here the code to read the file. I tried using the following two techniques but to no use... :(
    File accountPropertiesFile = new File(FacesContext.getCurrentInstance()
    .getExternalContext().getRequestContextPath()
    + FilePath);
    properties.load(externalContext.getResourceAsStream(FilePath));
    </code>
    But none yeild any sucess while reading through the Bean class. please help...

    Your source code isn't there at run time, at least it shouldn't be, so the directory structure you've shown is irrelevant.
    If the file is in the corresponding position under WEB-INF/classes at runtime, the second technique should work, but you need to fix FilePath to agree with what it says under Class.getResource() and friends.

  • "The system cannot find the file specified" - error reading properties file

    I have packaged a class file and a .properties file in the same folder as a ejb-jar file and in the class file i try reading the properties file and it throws me the error - "The system cannot find the file specified". But when I put the complete path, it has no problem finding the file.
    I know that this must be the problem with classpath, but can anybody tell me why it is not finding the properties file even if they are in the same folder. How do I make class files find .properties file which are in a folder.
    Any help will be greatly appreciated.

    Hi,
    I am not sure if your question is realted to the Oracle Application Server - anyway, if you are packaging a class file and a properties file in a JAR File, you need to read the contents in a different manner...something like this... :
    URL url = new URL("jar:file:/home/duke/duke.jar!/");
    JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
    You might want to have a look at this link for more information :
    http://java.sun.com/docs/books/tutorial/index.html
    You may also get better responses if you post your question in one of the Java Forums.
    Regards,
    Sandeep

  • How to read properties file?

    hi,all friends,can you tell me how to get information from the properties
              file such as weblogic.properties or
              user defined properties file? And where should I put the properties file?The
              location of properties file
              should not be pre-defined in the source code.I wanna get the location of
              properties file from weblogic.properties .
              Help me and thanks a lot..
              Tony tian
              

              Hi Tony,
              for example in your init() insert such codes:
              Properties props = new Properties();
              FileInputStream fin;
              try {
              fin = new FileInputStream("weblogic.properties");
              props.load(fin);
              fin.close( );
              catch (IOException e) {
              throw new ServletException("blabla:", e);
              and verify the key, say: weblogic.system.bindAddr, you will get a string (exist) or null (non existing). for example:
              String s = props.getProperty("weblogic.system.bindAddr");
              if (s != null) {...} // existed
              else {...} // not existed
              Joe
              "Tony Tian" <[email protected]> wrote:
              >hi,all friends,can you tell me how to get information from the properties
              >file such as weblogic.properties or
              >user defined properties file? And where should I put the properties file?The
              >location of properties file
              >should not be pre-defined in the source code.I wanna get the location of
              >properties file from weblogic.properties .
              >Help me and thanks a lot..
              >Tony tian
              >
              >
              

  • Reading properties file in Webspehere

    Hi All,
    I am using a web application which uses a prperties file containing JNDI url (DB userID and password also ). This properties file is not packaged inside the war and kept in a folder named config. I have worked on App servers like Resin and Tomcat, I usually place the config folder in the server root, lets say Tomcat\config or resin\config and it works fine with both.
    But when it comes to Webspehere, I have kept the folder in WAS Root/config and even WAS Root/Appserver/profiles/server name(eg. Appsrv01)/config, but it seems not to be working.
    - Is there any other place where I'll have to place the folder ?
    - Are there any configuration changes that need to be done for the properties file to be read ?
    just to give you idea of the logic I use to read the properties file is :
    public class PropertyManager
    Properties property;
    public PropertyManager()
    // create and load default properties
    try
    property = new Properties();
    property.load(new FileInputStream("config/systemProperties.properties"));
    catch (IOException e)
    e.printStackTrace();
    public String getProperty(String propertyKey)
    String value = property.getProperty(propertyKey);
    return value;
    public static void main(String[] args)
    System.out.print(new PropertyManager().getProperty("user"));
    Can anybody help me regarding this ??
    Thanks in advance,
    Cheers,
    Partha

    Well there are two things involved here one of them is folder/directory permissions applied on the location which you are talking about.I'd say you might have to test on the user profile on which WAS service is currently running and a recommendation would be if i were i'd have posted in around respective user.home folder on to which i'd nt any messups with permissions on folder.

  • Error reading properties file upon deployment

    hi. i'm still relatively new with regards to the Java programming language. in any case... i am developing a simple project wherein the application has to make a database connection to a server. the application is finished already however.. i am having problems deploying it.
    my project has a "resources" package containing the file "config.properties" which contains various information (connection details among others). correct me if im doing something wrong, but in deploying in, i copied the "dist" folder of my compiled code and then tried to run the java exe independently which resulted in an error. i already tried copying the "config.properties" file to the dist folder and even creating a "resources\config.properties" file but it still results in an error. could you please help me figure out how to deploy the application with the properties file. the code i used in referencing my .properties file is as follows:
    Properties configFile = new Properties();
                configFile.load(this.getClass().getClassLoader().getResourceAsStream("Resources\\config.properties"));
                String username = configFile.getProperty("username");
                String password = configFile.getProperty("password");
                String url = configFile.getProperty("url");
                String dbtype = configFile.getProperty("dbtype");
                Class.forName(dbtype);
                conn = DriverManager.getConnection(url, username, password); thanks in advance. ^^

    thank for the help mangst. i guess the IO approach is also applicable ^^; i changed my code to:
    configFile.load( new FileInputStream( ".\\resources\\config.properties" ) );but i had a little trouble in debugging it since it starts the file search from the main project directory. however it works fine upon deployment. ^^; thanks again.
    Edited by: xnofate on Sep 23, 2008 6:21 PM

  • Help with utl_file (read/write file from local directory)

    Need help reading/writing file on local machine from plsql using 10.2 DB.
    I am trying to read/write a file from a local directory(laptop) without success.
    I have been able to read/write to the database server directory but can't write to directory on local machine.
    The utl_file_dir parm has been set to * and the db restarted but I can't get it to work... Here's the plsql statement.
    out_file := UTL_FILE.FOPEN ( 'C:\PLSQL', 'TEST.TXT', 'W' ,32767);
    Whenever I run it continues to write to c:\PLSQL dir on the database server. Have looked at the "Directory" object and created MY_DIR = C:\PLSQL but it writes to the db server.
    Running 10.2 on a remote windows server, running PLSQL using sql*navigator.
    Thanks in advance for your help..

    I don't see how you expect the server to be able to see your laptop across the network, hack into it and start writing files. Even if it could, what if there is more than one laptop with a C: drive? How would it know which one to write to?
    Is there a shared drive on the server you can access via the laptop?

  • Jar files required to read excel file in SAP PI 7.3.1 sp09 dualstack

    Hi experts,
    I need to read excel file (.xls) using SAP PI and process it to target system. I have read blogs
    and found that there are 2 ways to read an excel file in PI using file adapter.
    1) Developing a custom adapter module
    2) Using XSLT code.
    So in order to develop a custom adapter module, i have followed the following blogs
    **************** - XI - Step-by-step guide to develop Adapter Module to read Excel file
    and
    Excel Files - How to handle them in SAP XI/PI (The Alternatives)
    and
    http://wiki.scn.sap.com/wiki/display/ABAP/Adapter+Module+To+Read+Excel+File+with+Multiple+Rows+and+Multiple+Columns
    I am unable to find the jar files in SAP PI at OS level as per the first blog(think they were obsolete).
    Please let me know
    1) What are the required jar files needed to read excel file and their location
    2) Even if i use the old jar files as mentioned in the first blog can i achieve my requirement
    3) Following this blog Convert incoming XML to Excel or Excel XML – Part 1 - XSLT Way if i apply the same logic at sender side, will it work? Because through case studies i came to know that we cannot read a .xls file using XSLT code. Correct me if i am wrong.
    Looking for your valuable suggestions.
    Regards
    Shilpa

    Hi Shilpa
    Welcome to SCN!
    The blog you refered to might be for previous versions of PI. You can refer to the following two wikis to find out what are the relevant JAR files for PI 7.3 and also how to get them.
    XI libraries for development - Process Integration - SCN Wiki
    Where to get the libraries for XI development - Process Integration - SCN Wiki
    It also looks like for newer versions, you might not need to manually get and add those JAR files into your NWDS project - please refer to the first comment on the blog below. I have not tried it personally as I'm not using the latest NWDS, but you can try that first, and if it does not work, then go get them manually.
    PI 7.4 - Adapter Module Creation using EJB 3.0
    Do note that you should be using the JAR files that is corresponding to your PI server version.
    As for your third question, that does not apply to you. XLS is the older non-XML format, and therefore cannot be read by XLST since it is in binary format.
    Rgds
    Eng Swee

Maybe you are looking for

  • Error when checking for layout in sap system.

    Hi,    We have downloaded the Adobe Life Cycle Designer 8.0 from service.sap.com.As in our system we have already installed the SAP GUI ,we only run the ALDsetup. exe to install the Adobe Life Cycle Designer 8.0 .When we checked in our backend SAP sy

  • ADF 11g and Peoplesoft/Weblogic License

    Hi, My understanding is that ADF is included in every WebLogic license, does anybody know if this also applies to installations of Oracle Peoplesoft that include WebLogic Server or would a separate ADF license be required to implement ADF components

  • Make entries in table T095

    Hi all, Iam unable  to make entries in table T095, if i use through se11->utilitis then create entry option is disabled. if i use sm30 then it saying " The maintenance dialog for T095 is incomplete or not defined" please give me procedure to maintain

  • Shutting down from Sleep

    I received a swapped out 8gb iPhone yesterday and restored everything with no problem. But: the phone automatically shuts down after a few minutes of sleep. I've tried resetting and restoring, with no help. I've seen a couple of references to this pr

  • Select.........upto 1 rows syntax

    plz sent the syantax select..........upto 1 rows