How to find relative address of a file?

I have a folder structure as below:
A
+-B
  +-D.class
  +-D.java
Daop.propsThere is a folder named A along with a file Daop.props (not inside folder A) . Inside A there is another folder B which contains D.java and D.class. From this D.java how to access "Daop.props".
Consider the following code inside D.java ..
var1.loadSystemProps(getClass().getResourceAsStream("Daop.props"));The above statement searches inside B directory..
var1.loadSystemProps(getClass().getResourceAsStream("/Daop.props"));The above statement searches inside A directory which is just above B., ie., the above code searches the neighbors of B...
How to make it search neighbors of A... what is the code for it...
For the given directory structure the both of the code shows java.lang.NullPointerException
Please help...

I guess you could also use the classLoaders get resource, which has no concept of "current directory with the jar".
o.getClass().getClassLoader().getResourceAsStream("Daop.props")http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)
Finds the resource .... in a way that is independent of the location of the code.
Hope that helps, even if I'm a bit late.
Cheers. Keith.

Similar Messages

  • How to find out the source program file in Proposal in Sales Online in CRM

    How to find out the source program file in Proposal in Sales Online in CRM

    You can find it in the oracle->apps->prp directory.
    It is the $JAVA_HOME

  • How to delete line/address in PDF file?

    How to delete line/address in PDF file?
    Joan Willets

    You delete it with teh touchup text/ touchup object tools in Acrobat or mark it for redaction, so it gets blackened.
    Mylenium

  • How to find my iphone back up file in pc without iphone connect

    How to find my iphone back up file in itune without connect my iphone? I lost my phone and urgently need to find my contacts in PC, anyone can help?

    You don't. It's gone. You should really pay more attention to the prompts that pop up on your computer before you just click 'ok'.

  • How to find mac address of a client computer in specified time and port in WIFI WCS Control system

    how to find mac address of a client computer in specified time and port in WIFI WCS Control system

    WCS record-keeping is very crude.  
    You'll get the time/date when the client authenticated.  You'll get the local inside address but you'll need the router to translate the outside IP address and the port.  
    You will need a proxy server to determine what sites did a wireless client goes.

  • How to find Related Tables for the Tcode given.

    How to find Related Tables for the Tcode given. (master data)
    Thanks in advance.

    Hi Sridhar,
    Welcome to SDN.
    The tables for a given transaction can be seen in the transaction SE80.
    First goto SE93.
    Give ur Tcode and find the program name.
    Now goto SE80. select program in the first dropdown and give the program name in the second box. U can find the list of tables used.
    One more way is : use ST05.
    and One more is using FM 'get_tables'
    Thanks,
    Shailaja
    Edited by: Shailaja on Jul 11, 2008 12:33 PM

  • How to find out Address no for each item

    Hi All,
    how to find out address no (ADRNR) for each item in the PO (ME23N).
    will it created by automatically or mannually?
    Please Very urgent.
    Thanks,
    Subbu.

    Hey Subbu,
    We meet again
    check
    table EKPO
    for each line item for a particular PO
    there u have adrnr.
    This is the  address number for each line item

  • How to find port address in AL11

    Hi ,
    In transaction AL11.
    I need to know the port address defined for the directories in AL11 .
    How we find the port?
    Good answers will be really appreciated .
    Regards & Thanks
    Sandeep

    Hi,
    Please check the table
    user_dir for this
    report - RSWATCH0 to refer to directories.
    FM   - /SAPDMC/LSM_F4_SERVER_FILE.
    Other AL11 related FM
    EPS_GET_DIRECTORY_LISTING      Get directory listing
    EPS_GET_DIRECTORY_PATH         Get directory path for EPS subdirectories
    EPS_GET_FILE_ATTRIBUTES
    EPS_GET_FTP_SYSTEM_INFO        Get ftp system info
    EPS_INFO_TO_STRING
    EPS_OPEN_INPUT_FILE            Open file for input
    EPS_OPEN_OUTPUT_FILE           Open file for output
    Thanks & Regards,
    Chandralekha.

  • Windows 2008 Server crashed - How to find location of remote shared files that they used to access on remote web app?

    We have a client that was running windows 2008 server.  A previous IT person had setup their system, so we were walking into a situation where there were many unknowns.  Server was mainly handling emails only, and we were able to get their exchange
    database off and export PSTs to hosted exchange via microsoft.
    Everything went fine with that, however one user said that he used to access files on the server via the remote web app as he described.  He would go to the following url:
    https://mail.theirdomain.com/remote/menu.aspx#
    and he would use his login and then he would see several links to folders.  He could then click on those and see his desired files.  
    We were able to get the server booted again, however we could not find any of the files he described on it at all, leaving me to suspect that perhaps this remote link was accessing another PC.  
    We have the old server up and running, however the link above is no longer active because we have pointed the domain to the new hosted exchange server.  As I am still learning and my boss wanted me to research this on my own and figure out how to find
    out where these files are located.  Any advice would be greatly appreciated.  
    Just as a note I did try access mail.localhost.com/remote/menu.aspx# on the server but this did not work.  Is there any way in the IIS 7 management console to figure out where this was pointing to?  

    I figured it out - The server was using sharepoint to host these files.  I browsed localhost:987 and opened the sharepoint site locally on the server.  They had several documents to be exported, however when clicking on Open in Explorer it was
    giving an error that local client was not configured.  I installed Desktop Experience and after that was able to open it in Windows Explorer and copy all files off.  

  • How to find out the size of files transferred over the SQL * Net?

    I am trying to test the Advanced Compress (AC) for 11g Data Guard. When the AC is turned on, the archived log files are supposed to be compressed on the primary database server and sent over SQL*Net, then decompressed on the standby db server. We will see the file sizes are the same on both primary and standby servers. I want to verify that the AC works by monitoring how much data are sent over SQL*Net. Per Oracle, AC uses 35% less of the bandwith. That means the size of the files transferred should be at least 65% of the original size.
    Is there a way to find out the size through Oracle utilities? If not, how to find out by OS utilities? OS is Solaris 5.10.
    Thanks.

    I'm not sure this can be done via SQL*Net, but a network packet sniffer between the two servers should be able to help - you might want to contact your network team.
    HTH
    Srini

  • How do I restore addresses from archive file or time machine without iCloud overriding?

    I recently had an issue with my address book contacts.  About 90% of the contacts disappeared, then synched through iCloud to my iphone and ipad.....so nearly all my contacts were lost on all devices.  I have both time machine and an address book archive file.
    When I tried restoring from time machine, the iCloud synching saw it as an older version of the file and went to the deleted contacts version....i.e. I was right back where I started.
    When I tried importing from the address book archive, the same thing happened.....iCloud saw the imported version as an older copy of the contacts file and deleted out everything I had just imported.
    The only way I was able to get the contacts back was to go to time machine (with address book application open), select all the contacts, copy them, cancel out of time machine, and then paste the contacts into the current version of address book.....I guess the system sees that as a "new" version of the contact and doesn't overrite it.  Problem is that it doesn't carry over all the different groups that way, and I have to move addresses into the groups all over again....kinda time consuming.
    Any ideas on how to import from archive or restore from time machine (the normal way) without iCloud synching overriding the "older" and desired version of the file?  Address book doesn't have any option to "override current contacts with imported ones".....
    Thanks.

    Try this:
    Turn off your internet connection completely: check it's really off.
    Import your backup into Address Book.
    Select all your contacts.
    From the File menu choose Export>vCard and save the file somewhere convenient.
    Now turn the internet connection back on. Your contacts will disappear from Address Book again.
    From the File menu choose 'Import' and select the file you exported to.
    Hopefully this contacts list will stay in place: wait until it's synced to iCloud and check that it's on the website and syncs to your Phone.

  • How to find variables in an fla file?

    Hello all,
    I purchased a flash web template that is very complex, and
    have been learning flash more earnestly from it. I only know how to
    find actionscripts by clicking on frames in symbols with an "a" One
    such frame makes refences to _root.READ = 1 (another 2, 3, etc).
    Unfortunately I cannot find what "READ" is. Can someone help me
    with how is "best" to find variable declarations in a complex fla
    file with no familiarity with its creation?
    The specific coade I am looking at references a pop-up
    window:
    on (release) {
    _root.popup_pressed = 1;
    _root.scrHEIGHT = 555;
    _root.scroller.scroller.gotoAndStop(2);
    _root.TM_title = "Advertising and Marketing";
    _root.READ = 1;
    _root.scroller.gotoAndPlay("s1");
    All the best!
    Michael

    Thank you. I am also not savvy with flash (yet), and after I
    posted this I noticed an unexpanded list in the action pane which
    shows variables (left bottom corner). This alone was a big help. I
    also discovered the "Movie Explorer" and typing "READ" into that
    only gives me "Scene1" (the top level clip).
    I wanted to ask a follow-up question to your posting. I
    thought that only frames marked with "a" had actionscript code in
    them, but from your reply it seems that variables can be declared
    in ANY frame? So, to find the variable "READ" I need to click on
    each frame to find it?
    Best regards,
    Michael

  • How to find creation date of a file in RHEL 5

    We have instances having RHEL 5.10 in our setup. The file system type shown using
    df –T
    says that file system type is ext3.  The ls –ltr command seems to show the modification time but not created date.
    I hope my question is clear on how to find the created date of a file in Red Hat Linux.
    Requesting a reply to my query.
    Regards

    Hi,
    I agree with Dude.
    Also you can check the command find, this command has many options like:
    -atime n  
                  File  was  last accessed n*24 hours ago.
    -cmin n
                  File’s status was last changed n minutes ago.
    -ctime n
                  File’s  status  was  last changed n*24 hours ago.  See the comments for -atime to understand how
                  rounding affects the interpretation of file status change times.
    -mtime n
                  File’s data was last modified n*24 hours ago.  See the comments for  -atime  to  understand  how
                  rounding affects the interpretation of file modification times.¨
    Best regards

  • How to find MAC Address in Java, Windows Environment

    Dear All,
    How to find the MAC address of a machine, provided the IPAddress of the machine.
    Thnx in advance..

    Generally you can't. MAC addresses do not travel through routers.
    For computers on your local subnet: connect to the computer somehow so that your computer knows the MAC, then run the command "arp -a" with Runtime.exec() and parse the output.
    Or write a program/servlet that runs on the remote computer and returns that computer's MAC (or some of the MACs for computers with several network cards.)

  • How to find the size of a file or folder

    How can I find the size of a file or folder?
    I am trying to determine the size of my iPhoto and Mail folder.
    It says "Size: --" under general from Get Info.

    It's working fine...
    When you ask for that info, and Finder presents those '--' dashes instead of a value, actually, Finder is calculating the value in background.
    That's something that i recently noticed and wonder why tha heck he needs to do all that work by himself, kinda re-inventing the wheel of file size value "calculus"...
    I posted some thoughts about it here: File / Folder size... How do Finder gets it?
    Will appreciate feedback about this!
    Props!

Maybe you are looking for