How to give Path for a properties file

Hi,
I am using a SQL.properties file to load all my SQL statements to my EJB JDBC prepared Statement. I have placed the SQL.properties file in com.company.sql package. I have another SQL class in the same package which is loading the SQL.properties file to cache for future use. I am using the path as "SQL.properties" (the file name straight ) in the SQL class to access the properties file.
I am using Sun App Server 7. To get access to this file I need to copy the SQL.properties file to the config directory of the app server instance. Otherwise it is not able to locate the file. I don't want to put the properties file in the config directory of the app server instance. Please help me, what path I have to give to access the file from the package itself, rather from the config directory of server instance.
I think , some one who is doing localization can help me out here. They have to put the localized properties file to access the text out of it. Please help me. Thanks in advance.
Thanks
Amit

You can use ResourceBundle class to load this properties file from the classpath:
ResourceBundle props = null;
props = ResourceBundle.getBundle("com.company.sql.SQL");

Similar Messages

  • How to set Path for a properties file

    Hi,
    I am using a SQL.properties file to load all my SQL statements to my EJB JDBC prepared Statement. I have placed the SQL.properties file in com.company.sql package. I have another SQL class in the same package which is loading the SQL.properties file to cache for future use. I am using the path as "SQL.properties" (the file name straight ) in the SQL class to access the properties file.
    I am using Sun App Server 7. To get access to this file I need to copy the SQL.properties file to the config directory of the app server instance. Otherwise it is not able to locate the file. I don't want to put the properties file in the config directory of the app server instance. Please help me, what path I have to give to access the file from the package itself, rather from the config directory of server instance.
    I think , some one who is doing localization can help me out here. They have to put the localized properties file to access the text out of it. Please help me. Thanks in advance.
    Thanks
    Amit

    I am using the propeties file to get the SQL statements. I have all the SQL query statement in the properties file. I am creating a preparedstatement after getting the statement from the properties file with the id like we do in ResourceBundle. If I keep the properties file in the config directory of the Sun App Server instance , then it is working fine. But If I don't keep it there, then it is giving me a file not found exception.
    My SQL class which is accessing the properties file are in same package (com.company.sql). But still it is not able to find the file. As suggested by you, I tried it by giving the path as com.company.sql.SQL. Still it did not found the file. The file is there inside the WEB-INF/classess/com/company/sql/.
    Thanks
    Amit

  • Classpath root for locating properties file?

    I'm trying to read a property file from a pluggable Reports destination. I've tried placing it in the domain root and in the domain lib folder (I'm sure it was picked up there in a previous release) but I can't appear to find it.
    What is a general classpath root that could be used for storing properties files in?
    Thanks in advance,
    Nik

    Open your %DOMAIN_HOME%/server/AdminServer/logs/AdminServer.log and search for java.class.path.
    You'll see all classpath roots available, I'm using %DOMAIN_HOME%/config/soa-infra.
    Cheers,
    Vlad

  • How to give comments for a particular table

    hi..
    how to give comments for a particular table ..
    select * from user_tab_comments;
    tx in advance..

    Try this.
    SQL> COMMENT ON TABLE EMP IS 'THIS IS SAMPLE EMPLOYEE TABLE' ;
    Comment created.
    SQL> select * from user_tab_comments where table_name = 'EMP'
      2  /
    TABLE_NAME                     TABLE_TYPE
    COMMENTS
    EMP                            TABLE
    THIS IS SAMPLE EMPLOYEE TABLE

  • How to set password for a zip file and should be checked when reading that

    Hi friends,
    how to set password for a zip file and should be checked when reading that file???
    thanks.
    Praveen Reddy.J

    Heyy man, i think, u did not get my problem.
    all i have to do is:
    i have to create a zip file, and we should secure it with password when creating. and whenever the user wants to open that zip file he should provide correct passowrd otherwise he could not read that file. So, we should check for that also.
    Tanks for reply.

  • How to give authorization for create and change particular Condition Type

    Hi...
       In my requirement is , Only one user can be authorized to create and change a particular condition type 'ZABC' in vk11 and vk12 .
    For remaining condition type can be used as in normal .
    How to do this ? How to give authorization for a particular user for particular condition type ?
    Plz guide me ..
    Thanks in advance .
    Deepa .

    Hi Deepa ,
    u can check A.Object V_KOND_VEA, in user profile u can assign condition type or tables.
    have a word with ur basis guy , so he can help u in better way.
    aand also ref FM SD_COND_AUTH_CHECK
    Regards
    Prabhu

  • Changing File path for different TIFF files in a For loop

    Hi dear users:
    I am using "IMAQ write TIFF File.vi" that basically writes a TIFF file to a specified file path. However, I would like to CHANGE the file path for each TIFF file i save in a for loop. The reason for this is that the File path has to include the file name and I do not want to write over the same file name all the time in a for loop. What I would like to have are sequential TIFF images. So if the file name would be "Image", I would like the result to be Image0, Image1, Image2 and so forth when I run my For loop. Can anyone help me with this?
    Thanks

    Use the "Format Into String" and the "Build Path" functions:
    Message Edited by smercurio_fc on 06-26-2007 05:16 PM
    Attachments:
    Example_BD.png ‏3 KB

  • How can i set a path for my deployment files in weblogic server 10.3

    Hi
    How can i set the path for my WAR ,JAR files while deploying.i am using the wls10.3 version.
    is there any scripts for this ,please provide me.
    my Application is ADF 11g application.

    By "path", I assume you mean "classpath".
    The simplest way is simply to include the jars you need inside the web application or web module's WEB-INF/lib directory, EJB module's META-INF/lib directory, or EAR lib directory.
    If that's not practical, if you use NodeManager to start your servers, you can go to the "Server Start" tab in the server definition in the WebLogic console and edit the "Classpath" field, which defaults to no value. You can specify a classpath value there. Note that if you specify a value there, it REPLACES the default classpath for the server, it doesn't add to it. If you need to just add to it (a much more likely scenario), if the value references the value "$CLASSPATH" in it, that will reference the original classpath value that the server would have had.
    So, for instance, if you wanted to include the MQ jars in the server classpath, you could set a value like this:
    /usr/java/mq/lib/mq.jar:/usr/java/mq/lib/mqstuff.jar:$CLASSPATH

  • Relative path for servlet property file.

    I have the following java file. When I use the absolute path for the configFile, it works. I would like to know how I could use it as relative path as in installation, the name of the directory could change.
    How do I fix the problem? Thank you.
    ---------------------- LoadProperties.java ----------------
    import java.util.*;
    import java.io.*;
    public class LoadProperties {
    private String driver="";
    private String dbURL="";
    private String login="";
    private String password="";
    static public void main(String[] args) {
    LoadProperties lp = new LoadProperties();
    } // main
    public LoadProperties() {
    //String configFile = "C:/1LMS/web-app/WEB-INF/config/db.properties";
    String configFile = getClass().getResource("config/db.properties").toString(); <--- This line could not find the db.properties file.
    Properties Prop = new Properties();
    try {
    FileInputStream configStream = new FileInputStream(configFile);
    Prop.load(configStream);
    configStream.close();
    } catch(IOException e) {
              System.out.println("Error: Cannot laod configuration file ");
    driver =Prop.getProperty("driver");
         dbURL = Prop.getProperty("dbURL");
         login = Prop.getProperty("login");
    password = Prop.getProperty("password");
    printResult();
    } //Load Property
    private void printResult() {
         System.out.println("Driver = " + driver);
         System.out.println("dbURL = " + dbURL);
         System.out.println("Login = " + login);
    System.out.println("PSWD = " + password);
    } // class

    hi there,
    had the same problem... you need to use following API:
    http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
    In your case something like that:
    // get the servlet context
    ServletContext context = getServletContext();
    // directory name where the file is located
    String realPath = context.getRealPath("/config");
    // get real path to your file
    String propertyPath = real+"filename.txt";
    hope that helps!!
    minu

  • Why jre makes unnecessary trips to server for getting properties file

    Hi,
    I'm using ResourceBundle.getBundle("myresource") method for loading the resourcebundle. I have placed my myresource.properties file in the jar which loaded, when UI getting loaded. But I could see from the java console(by entering 5), that java-plugin makes several trips to server, though I have the file in the client loaded jar file. How can I avoid it. Thanks for any help.
    The search goes as follows:
    Opening http://<servername>:7001/myresource.class
    Connecting http://<servername>:7001/myresource.class with no proxy
    Connecting http://<servername>:7001/myresource.class with cookie "JSESSIONID=APBnBCd2y8mJRQgGM9GqzXAT197iMQv7SaM9QORKg5mxvyp1PRKh!-1116598258"
    Opening http://<servername>:7001/myresource_en.class
    Connecting http://<servername>:7001/myresource_en.class with no proxy
    Connecting http://<servername>:7001/myresource_en.class with cookie "JSESSIONID=APBnBCd2y8mJRQgGM9GqzXAT197iMQv7SaM9QORKg5mxvyp1PRKh!-1116598258"
    Opening http://<servername>:7001/myresource_en.properties
    Connecting http://<servername>:7001/myresource_en.properties with no proxy
    Connecting http://<servername>:7001/myresource_en.properties with cookie "JSESSIONID=APBnBCd2y8mJRQgGM9GqzXAT197iMQv7SaM9QORKg5mxvyp1PRKh!-1116598258"
    Opening http://<servername>:7001/myresource_en_US.class
    Connecting http://<servername>:7001/myresource_en_US.class with no proxy
    Connecting http://<servername>:7001/myresource_en_US.class with cookie "JSESSIONID=APBnBCd2y8mJRQgGM9GqzXAT197iMQv7SaM9QORKg5mxvyp1PRKh!-1116598258"
    Thanks

    The reason the unnecessary trips are being made is that the ResourceBundle is using the default class loader to find the resource files. When a resource can't be found in the jar file, it will send a request to the server to see if it exists there. For the locale "en_US" and the bundle name "myresource", the ResourceBundle will attempt to load all of the following resources:
       myresource.class
       myresource.properties
       myresource_en.class
       myresource_en.properties
       myresource_en_US.class
       myresource_en_US.propertiesSince, you only had "myresource.properties" in your jar file, the ClassLoader attempted to find the other resources on the server.
    The following code can be used to create a resource bundle that uses a special classloader that only searches the included jar or zip files. This only works on 1.2 or greater JVMs.
       public ResourceBundle getResourceBundle(String bundleName) {
          ClassLoader rcl = null;
          Locale l = Locale.getDefault();
          ClassLoader cl = this.getClass().getClassLoader();
          if (cl instanceof java.net.URLClassLoader) {
             java.net.URLClassLoader ucl = (java.net.URLClassLoader)cl;
             URL[] urls = ucl.getURLs();
             ArrayList jarUrls = new ArrayList();
             for (int i=0; i<urls.length; i++) {
                String path = urls.getPath();
    if ((path.endsWith(".jar")) || (path.endsWith(".JAR")) ||
    (path.endsWith(".zip")) || (path.endsWith(".ZIP")))
    jarUrls.add(urls[i]);
    URL[] newUrls = new URL[jarUrls.size()];
    jarUrls.toArray(newUrls);
    rcl = java.net.URLClassLoader.newInstance(newUrls, null);
    } else {
    rcl = cl;
    DiagUtils.log("Resource bundle: " + bundleName + " initializing...");
    ResourceBundle rb = ResourceBundle.getBundle(bundleName, l, rcl);
    DiagUtils.log("Resource bundle: " + bundleName + " initialized.");
    return rb;
    The basic idea behind this code is to create a new URLClassLoader which only contains URLs that end with ".jar" or ".zip". The parent classloader must be set to null in the newInstance method.
    This will not work on the MSJVM because URLClassLoader was introduced with JDK 1.2.
    I hope this helps.
    -jonp

  • How to ''give'' error for this case of an EXTERNAL TABLE?

    Our external table routine works fine:
    -- We have a csv file with 2 cols.
    -- When we create the table referring the csv it works fine.
    -- Even if the csv has more the 2 cols, the ET command only takes the 2 cols and it works fine.
    -- Now, users are saying that if the csv has more than 2 cols, the ET command should give an error
    I went through the command but cannot find any clause which will do this.
    Is there any other way or workaround?
    CREATE TABLE <table_name> (
    <column_definitions>)
    ORGANIZATION EXTERNAL
    (TYPE oracle_loader
    DEFAULT DIRECTORY <oracle_directory_object_name>
    ACCESS PARAMETERS (
    RECORDS DELIMITED BY newline
    BADFILE <file_name>
    DISCARDFILE <file_name>
    LOGFILE <file_name>
    [READSIZE <bytes>]
    [SKIP <number_of_rows>
    FIELDS TERMINATED BY '<terminator>'
    REJECT ROWS WITH ALL NULL FIELDS
    MISSING FIELD VALUES ARE NULL
    (<column_name_list>))\
    LOCATION ('<file_name>'))
    [PARALLEL]
    REJECT LIMIT <UNLIMITED | integer>;
    Is it possible to use the READSIZE?
    Edited by: Channa on Sep 23, 2010 2:28 AM

    -- Now, users are saying that if the csv has more than 2 cols, the ET command should give an error
    I went through the command but cannot find any clause which will do this.
    Is there any other way or workaround?I looked at Serverprocess' sql*loader script and did not see how that would answer your question - how to raise an error if the file has more than 2 columns. If I missed something can Serverprocess explain?
    I can't think of a direct way to do this with your external table either, but there may be indirect ways. Some brainstorming ideas of perhaps dubious usefulness follow.
    Placing a view over the external table can limit results to the first two columns but won't raise an error.
    A pipelined function can read the external table, check for data where there shouldn't be any, and raise an exception when you find data in columns where there should not be any.
    Similarly, you could ditch the external table and use utl_file to read the file, manually parsing and checking the data. LOTS more work but more control on your end. External tables are much easer to use :(
    Or, first load the external table into a work table before the "real" select. Check the work table for the offending data programatically and raise an error if data is where it should not be. You could keep the existing external table and not have to do a lot of recoding.
    Or, also load the data into an otherwise unneeded global temporary table first. Use a trigger on the load to look for the unwanted data and raise an error if offending data is there
    These ideas are boiling down to variations on validating the data before you use it.
    Good luck!

  • How to change path for Ev4Excel.xla

    Dear All,
    I'm trying to execute predefined BPF - custom menu (ProcessFunctions.xls). Whenever if click e.g. on Back, forward, open a file following similar message is being prompted:
    Macro 'E:\Program Files\BPC\Ev4Excel.xla'!'EvMacroCall "OPENFILE","REPORTS\WIZARD\HotAnalysis\A01 Account Trend.xls","","","","","" can not be executed. Macro may not stated in this workbook or all macros can be deactivated.
    Ev4Excel.xla is resided under path E\PC_MS.
    How can I change path for macro call?
    Or any other idea?
    Regards,
    Ender

    i don't understand why do you have to change the path for Ev4Excel.xla?
    Basically this the addin of BPC into excel. I mean it is the BPC excel client.
    You are choosing the path when you are performing the installation of SAP BPC.
    So Idon't understand why do you want to change the path?
    If you want to do this you have to reinstall the BPC client and you have to choose the path wanted.
    You error is not related to the path it is more related to rights.
    I think you have to provide more details about the steps done and in what condition you observer this error.
    Regards
    Sorin Radulescu

  • How to read JBoss server 'app.properties' file in the deployed Flex application?

    Hi, my current Flex project is using LCDS server to make call (Remote object call and Data managements services' call) to the backend Java services and consume data to render. I have defined the AMF and RTMP channels in the services-config.xml file and destinations for the Java services' in the remoting-config.xml and data-management-config.xml files.
         <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://localhost:8080/eqcFlex/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
                <properties>
                    <polling-enabled>false</polling-enabled>
                </properties>
         </channel-definition>
    As of now both the Flex application WAR file and Java services EAR files are depolyed on the JBoss server on my machine, therefore I can hardcode the endpoint URL as http://localhost:8080 in the services-config file and hit the Java services.
    But the requirement is that the Flex application WAR file needs to be deployed on JBoss servers deployed on different machines and hence the endpoint URL cann't be hardcoded in the services-config.xml file. Is there a way we can pick up the endpoint URL from the JBoss server's app.properties file so that we can dynamically create channels in Actionscript code and make call to the backend services with dynamic endpoint URL?

    But in Command prompt I found out that My properties file by name
    'cedrelay.properties' is not recognised by web.xml.My web.xml structure is
    How does web.xml "recognize" anything?
    You specify the properties file as an init parameter. Do you read it in the init method of the servlet? If so, what does the code look like for reading the properties file?
    You'll have better luck if you put that properties file in WEB-INF/classes and load it as a resource input stream from the CLASSPATH.
    %

  • Tool for generating properties files

    Hello Experties,
    I am wondering is there a tool or program for SAP to get SAP fields screen names from SAP backend for diffrent languages and generat the properties files?
    for java uwl or webdynpro they are all the same properties file.
    thanks

    WebDynpro i18n is done by .xlf files. Its an standard (http://en.wikipedia.org/wiki/Xliff) and there are some OSS editors available, just google xlf editor.Or check this one: http://okapi.opentag.com/applications.html#rainbow
    The Idea is, that you give your xlf files to the translator and safe the results with a suffix representing the language (_de.xlf for german).
    Hope this helps.

  • Specifying a path to loada properties file

    I'm trying to load a properties file in java, the properties file is located in
    META-INF/sample.properties
    the class that loads the properties is in
    WEB-INF/classes/com/pkg1/pkg2/pkg3/pkg4/samplepgm.java
    how do I specify the path to load the properties file...

    you can only add images by using the place-function
    so you need to address the rectangle where the image is placed in.
    you can use use scriptlabels and then you can use something in the terms of
    document.Rectangles.Item("image").place(linktoyourfile)

Maybe you are looking for

  • Can the apps used on an iPhone be used on am iMac/

    Can apps used on an iPhone be used on an iMac?

  • I have a gift card but when I try to redeem it will not accept any number on the card. Which number am I suppose to use?

    I have a gift card but when I try to redeem it ask me for a code number, I am not sure which number to use but have tired all three that are on the gift card but none have worked.  Can anyone tell me which number to use.

  • Web services for forms 10g

    Hi, Can anybody explain how to use web services in forms 10g. I have a wsdl url with me which I need to call. I also heard that I can use utl_http and utl_url package. Anbody knows what it is. So basically there are two ways to call web services into

  • IMessage & iPod

    Hello everybody, I have two little issues. Maybe someone has an advice or can help me to understand the problem: I have an iPhone 4S with the latest iOS update! If you need more details, just let me know. 1. When I started using iMessage, as describe

  • "The Skype Contact"

    Hello, Does anyone know the username of "The Skype Contact" as described here? https://support.skype.com/en/faq/FA34479/what-is-the-skype-contact I'd like to add it to my contact list so i can get some tips. Thanks! Solved! Go to Solution.