How do I load a properties file that is in the same package?

I have the following package:
com.company.ldap
In the package I have:
main.java
settings.properties
I want to load the values in the settings.properties file in code, such as:
propertiesFile = "settings.properties";
        try {
            properties.load(new FileInputStream(new File(propertiesFile)));
        } catch (IOException e) {
            ... error logging logic ...
        }I keep returning "The system cannot find the file specified".
How do I properly load a properties file in a class file within the same package?
Thanks,
--Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Put the file in the classpath (such as in the parent directory of com/company/ldap). Then obtain an input stream to that file like this:
InputStream stream = getClass().getResourceAsStream("/settings.properties");
Then use that stream in the properties.load method. Remember to close the stream as well.

Similar Messages

  • How do I create a .llb file that holds all the subVIs used in a VI?

    Hi
    I wish to create a .llb file that holds all the subVIs(~200) used in my main VI.
    When I open my main VI, and look into the 'show VI hierarchy' I see a lot of subVIs, so to copy all these subVIs into the library file is going to be really time consuming. I am hoping there is an option in Labview by which I could automatically put all these subVIs into one library file?
    Thank you
    Gautham Radhakrishnan
    Dept. Of Physics
    University of Toronto

    In your toplevel VI, go to "File..save with options".
    Now select "Development distribution", press save, and give it a name for the llb.
    LabVIEW Champion . Do more with less code and in less time .

  • How do I create a .llb file that includes only the subVIs used in a VI?

    hi....
    can anybody help me ...i wanna creat a library file that holds only the sub-VIs that are running in particular main VI .
    are there options for that in labview??

    I don't think understand the answer. From just the top level VI, do like I said and an llb will be created with the top level and all subVIs. You can also edit the llb (Tools>Edit VI Library) and make your main VI top level. A note of caution. An llb was originally designed as a means of storing VIs with extended names. With modern OS's allowing long file names, an llb is less useful except as a convenient means of distributing a group of VIs from one location to another. This would be done as a final distribution such as an instrument driver or to another developer who would then convert the llb to a folder. There are several problems with keeping the development VIs in an llb. One is that it doesn't work with any form of source code cont
    rol. Another is that a corrupt VI in an llb can and has made the entire llb unreadable so unless you are absolutely religous about backups, you made find yourself in deep trouble some day.

  • How do I convert multiple RAW files to JPEG with the same settings?

    I have a considerable number (800) RAW files to convert to JPEGs. I am happy to convert them in batches requiring similar settings to save time whilst of course, leaving the original RAW files to make more individual adjustments if required later.
    I thought there was a way of doing this in small batches to save time but can't recall how to do it. 
    Can anyone help?

    Many thanks Barbara and dj_paige.
    What I didn't mention is that I'm using PSE 5 with ACR 4.6, if its relevant.  I'm thinking of updating to the next version when its out in the hope that it will run with Windows 7 64 bit or I may go to Lightroom.
    I can now see that I can batch convert a whole folder of files using "process multiple files" as dj_paige suggested but that is too many at once as the settings I choose won't be relevant for all the pics in the folder. 
    I was hoping to batch convert say 5 or 6 similar photos at a time with the same settings. I'm not quite clear what you're suggesting but I'm hoping that its a "work round" using two stages to achieve this. 
    I can't see a list of open files within ACR to ensure that they are all selected as you suggest. 
    What does clicking Open rather than Done mean?  Does this amend the original RAW file to the settings selected so that if I then "process multiple files" on the whole folder to convert from RAW to JPEG they will in fact have already been processed in smaller groups so I can convert without applying any further changes?
    If so, what settings should I apply to "process multiple files" to ensure a simple conversion of file type rather than any further adjustments?
    Any further help on this would be much appreciated.
    Andrew

  • How is it possible to make sure that LV uses the same thread for several threadsafe DLL calls?

    Hello,
    i have a thread safe DLL and most functions are called from serveral threads from the LV apllication without problems.
    In case of an error i have to call an error handler function in this DLL (like WinAPI: GetLastError()) from the same thread which has called the function that failed before.
    I can't use the user interface execution because some functions need a long execution time and i don't want to balk the user interface.
    All other executions than the user interface execution have more than one thread and in most cases the DLL function calls were executed from different threads - so the error handling doesn't work...
    Any idea?
    Thanks for your help!

    Hmmm....
    How about wrapping all of your dll calls in a single VI (or an Action Engine ) and make sure the VI's thread is NOT set for "Same as caller".
    "Threadconfig.vi" (sp?) will also let you dictate the number of threads associated with an execution system. Set your target thread for "1".
    Not sure on the above.
    Please correct me if this is wrong!
    Ben
    Message Edited by Ben on 07-19-2007 08:26 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • What is the code to load a .swf file in AS3 on the same layer?

    I'm new to AS3 and am trying to figure out the code for loading a .swf file on the same layer of the same page, thereby replacing all of the information. I don't want to put it on layer 2, etc. Another easy thing I can do in AS2 but am struggling with in AS3.
    thanks!
    Steve

    There are no 'layers' in AS3 - there is just the display list. You can use addChildAt to add things at a specific depth - thereby placing it behind or above something, but if you just use addChild it goes on top of whatever is currently there...
    Anyway - to answer your question, you can load a .swf with a Loader object like so:
    var l:Loader = new Loader();
    l.load(new URLRequest("myFile.swf"));
    addChild(l);
    You can wait for complete like was shown, but you don't have to. And this will not 'replace' anything - it just loads myFile.swf on top of anything currently being shown. If you want to 'replace' what's there you need to remove it first:
    while(numChildren){
         removeChildAt(0);

  • How do I FaceTime using two iPhones that are on the same iTunes account?

    My husband and I share the same iTunes account for both of our iPhones. How can we FaceTime each other?

    Pretty easy actually.  I had this same issue a few weeks ago when I got my wife an iPhone.
    Go to Settings > FaceTime > int there, it will say recieve calls at "X" amount of locations.  When you open that, you can check and uncheck email addresses and phone numbers.  You can also add and/or remove email addresses.
    Once you do this, you will want to go into Messages and do the same thing there as well.  Otherwise you will recieve each others iMessages too.
    Good Luck!!  Cheers!

  • How can I load multiple compositions, all to play at the same time? eg 3 slideshows

    Hi
    Hoping someone at adobe edge animate can help me with some custom code as I need to load 3 different compositions all onto the same webpage.
    I have been through the Bootstrapper instructions thoroughly and have tweaked the code to try to get it to do what I require but I still can't make this work.
    I have 2 slideshows one footer one banner and also a small logo animation.. all need to reload and loop continuously.
    So far I have managed to get all three up but they all interfere with each other and none are playing properly.
    This is an urgent job for a client so I would really apprecaite some help.
    Thanks.. !
    Alayna.

    hi alayna,
    its definitely possible - see this sample:
    http://salesdigital.com/multiedge/
    3 edge compositions in one html page
    just check the page source code - in the head tag - it's not as bad as you think..
    hope this helps!
    ~keith

  • How to rename two external hdd's, that are exactly the same brand and model, in order to distinguish?

    Hello again.
    First of all excuse me if I mistype anything or fail to use some terms correctly. English is not my mother tongue and I am kind of new to MacBooks.
    Here's my problem.
    I've got a macbook pro (yosemite 10.10.1, retina, 15", late 2013, 8gb memory, 250gb ssd), and I am using an external hard drive which I found to be quite good for what I wanted (in case it matters it's the lacie porsche design 2TB USB3).
    I wanted one more external hard drive, and since I was satisfied with the one I had bought before, I decided to go for that one again.
    Now the thing is that, when I go to finder I see 2 disks with the same name (and their "share" partitions) and I don't know which is which.
    I'll try to post a screenshot that might clear things out.
    What I would like to do would be to somehow rename the second disk so it appears in the finder as (for example) Lacie1 and Lacie Share1.
    Apparently, the system kinda thinks in a similar way as I do.
    As you can see below, it has done exactly what I want to do in Lacie's manager (or however it's called), but that does not appear in finder.
    (some words are in Greek, but you'll get the point)
    So, is there any way I can do something that will make the disks appear like that in finder so I can differentiate among them?
    Any help would be greatly appreciated.

    Connect the external HDD to the MBP.  Click in the title below the icon two times.  It should then allow you to change the name.
    See this example:
    Ciao.

  • How do I create a text field that automatically enters the same info on proceeding pages

    I know this is a basic question for Acrobat Pro, but I'm a newbie at it.  Basically, I work with pdf forms in education and I would like to figure out a way where if I enter for example someone's birthdate in page 1, and it automatically enters it in pages 2, 3, 4 and so on of the same document.
    Also, along the same lines, is there an easy way to be able to edit multiple pages of a document at once. Example: A lot of the people at my office that use the copy and paste feature in the pdf documents, and often overlook changing the "he" to a "she" and "his" to a "her" and as a result we end up with filled forms that use the incorrect sex.
    I apologize in advance if I'm not being very clear, but is the best way I can describe my problem.
    Thanks

    1. You can duplicate the field. Right-click it using the Select Object Tool and select Duplicate. You can then select the page range.
    Otherwise, you can copy&paste it, or create a new field and give it the same name as the original.
    2. No.

  • How do I embed an audio file that plays through the entire book?

    I would like my students to listen to a story as they read it. Is there a way to embed the audio file and have it play through the entire book? I successfully embedded the audio file, but it stopped playing when I turned the page.

    Audio is user controlled on a page-by-page basis in an iBA'd iBook.

  • I have two ipad2's how can i load purchased apps to each ipad2 from the same itunes library?

    I have two iPad2's and I wish to load purchased apps from our iTunes library to our newest iPad2.  Can anyone direct me and or provide steps in completing this process?
    Thank you.
    texasboytn

    delete/uninstall the apps that your relative downloaded on you iPad. to do that tap and hold on and icon til it shakes, once its shaking downloaded apps will havee (X) mark on them on a red bubble, tap on it to delete

  • Itunes trys to load my genius files and stops at the same point everytime

    Itunes trys to load my genius and it freezes up evertine after the progress bar gets under the in in information. I have to close out the program in order to regain controlle of the computer.

    Maybe:
    iTunes for Windows Vista or Windows 7: Troubleshooting unexpected quits, freezes, or launch issues
    iTunes for Windows XP: Troubleshooting unexpected quits, freezes, or launch issues

  • How to load a properties file?

    Hello Everyone,
    We are experiencing difficulties when trying to load a properties file from a directory other then the one where the servlet is located. We are using the following code for this purpose:
    private final String PROP_FILE_NAME = "my.properties";
    Properties props = new Properties();
    try {
    props.load(getClass().getResourceAsStream(codeBase + PROP_FILE_NAME));
    } catch(IOException e) {
    //handle error ...
    where codeBase is either physical directory path to the properties file or the URL. In either case we get a NullPointer exception which means that file is not found. But when we copy the properties file into the same directory where the servlet resides, everything works fine.
    Does anybody have an idea as to how to resolve our problem?
    Any help will be greatly appreciated!
    Thanks in advance!
    Y.M.

    URLs try to address this issue for cross-platform file reference.
    I'd try doing something like:
    URL u = new URL(codeBase + PROP_FILE_NAME);
    props.load(getClass().getResourceAsStream(u));
    Regards,
    Eric

  • How to load a .properties file by giving relative path in a JSP file.

    Hey guys,
    I'm trying to load a .properties file in a JSP using relative path...
    It is not taking the properties file..
    What is the problem...?
    Any solution..?
    Thanks a lot.

    Yes I tried that also.
    Your path was something like this ?
    http://localhost:8080/Database/a.properties ?
    Whether this path will change after client installation ? if no then what's the problem ?
    For client side installation how you are going to set your conf directory for your application ?
    You are not going to give client installation page ?which will have all the values to be set like conf path. database,user name(s),log folder,temp folder etc ? Why you are keeping everything on server ?
    Check if this is useful,
    String context = request.getContextPath();
    String rmtAdd = request.getRemoteAddr();
    String host = request.getRemoteHost();
    out.println("http://"+rmtAdd+context+"<BR>");
    out.println("http://"+host+context);
    "http://"+rmtAdd+context
    Edited by: kanad on Jan 12, 2008 1:29 PM

Maybe you are looking for

  • SCCM Task Sequence no longer installs SCCM Client

    I am using SCCM 2007 R3 with SP2 and MDT 2010 My task sequences were all working fine until one of the other SCCM admins "Synced all sites" by transferring the site settings of one site to all the other sites.  How this broke OSD I don't know. At thi

  • Errors- Runtime() in Swing Help

    Hi, Iam trying to use Runtime() in Swing..iam getting nonsense errors what have i missed? import java.io.*; import java.util.*; import javax.swing.*; import java.awt.event.*; import java.awt.*; public class appSrunCommand extends JApplet implements R

  • WM process flow diagram

    Can anybody help me to get process flow diagram of any standard WMS in SAP? I appriciate your help Thanks,

  • AUC / CIP - Assets

    Hi Guru's, We currently do not have asset module set-up in the system. We have been making manual entires through FB60. Credit - vendor account Debit - CIP clearing account & Tax / VAT account. So there is no link to an internal order or purchase ord

  • Autotrace Output - Gets of data

    Hello guys, a little question regarding the counts of gets by "set autotrace on". I got the following statistic: 0 db block gets 154843 consistent gets 154812 physical reads I know db block gets + consistent gets = logical i/o But does are physical r