How to get path

Hello
How do I get the current path an object is executing from? This is for a simple test. I have a file I want to open up within my object. That file is being copied to the .class directory where my object is. I just want to figure out how to use some static method of the Class to find where it is so I can use it. I am sure this is the wrong way to do it, if even possible. I just need this as a "throwaway" technique. tia.

See http://www.rgagnon.com/javadetails/java-0076.html

Similar Messages

  • How to get path of a specified file

    how to get path of a specified folder
    my code is as follows: Iam using struts 1.2
    my directory structure in tomcat/webapp is as afollows:
    sfq
    |
    | _ _xml
    | |     
    | |_ _ sqx_read.xml
    |
    |__jsp
    |
    |__WEB-INF
         |
         |_ _classes
              |
              |_ _ReadXml.class
    Now i have to get the path of a sql_read.xml file which is in xml folder from ReadXml.java file. pls it's urgent

    Urgent or not, you can obtain the document root directory as
    ServletContext.getRealPath("/")

  • How to get path of downloaded file?

    Hi,
    I use JDeveloper 11g with ADF.
    I have to download file with original date. If i want to save date i have to zip file. After that to unzip. My queation is: when clien download file how to get path of downloaded file????
    Because, i want to save unziped file on location where client want to download.

    Hi,
    you cannot download a file directly to a client. If this is a requirement then you need a signed Java Applet to handle the download. Otherwise a download dialog is opened for the user to define where to store the file.
    Frank

  • How to get path of jar file

    I am using a class which is present in a jar file.
    There are lot of versions of this jar file are present on machine.
    I am accessing one class from this jar.
    How do I know which jar is used by application.
    How to get the path(path on machine like c:\java\lib) of this jar file.

    URL jarURL = this.getClass().getResource("/whatever.class");will return you a jar:// URL. Experiment with that. (Remember that "whatever.class" needs to be prefixed by the full name of the package the class is in.)

  • How-to get path to a node in SPRO

    Hello guys,
    I'm working on a tool which creates automatic dcumentation tool of changes in SPRO. All goes fine except one thing:
    I need to generate a PATH to IMG ACTIVITY. I know the code of activity, I know it's HIER_GUID. What I need to get is all "parents" HIER_GUID of bottom node.
    So far I got only one FM - STREE_GET_PATH_TO_NODE. It's fine but it returns only the path to 03 level in SPRO. (01 - is top, 02 - are components).
    What I desperatly need is how to get a connection from 03 to 02 level.
    You can simulate the FM with following values:
    SEARCH_FOR_NODE-NODE_ID = 1C1B49FEC279D411AB74009027B70B8E
    SEARCH_FOR_NODE-TREE_ID = 367A8DF9ACEE16E7E10000009B38F976
    The result contain the highest node id 367A8DAFACEE16E7E10000009B38F976, which stands for "SAP Business Parnter" (according the table TNODEIMGT-NODE_ID).
    But the fact, that "SAP Business Partner" is in "Cross-Application Components" is unreachable for me.
    Do you know, how to get relevant node on level 02 ?
    All hints will be rewarded.
    Thank you
    Regards
    Tomas

    Hello guys,
    I'm working on a tool which creates automatic dcumentation tool of changes in SPRO. All goes fine except one thing:
    I need to generate a PATH to IMG ACTIVITY. I know the code of activity, I know it's HIER_GUID. What I need to get is all "parents" HIER_GUID of bottom node.
    So far I got only one FM - STREE_GET_PATH_TO_NODE. It's fine but it returns only the path to 03 level in SPRO. (01 - is top, 02 - are components).
    What I desperatly need is how to get a connection from 03 to 02 level.
    You can simulate the FM with following values:
    SEARCH_FOR_NODE-NODE_ID = 1C1B49FEC279D411AB74009027B70B8E
    SEARCH_FOR_NODE-TREE_ID = 367A8DF9ACEE16E7E10000009B38F976
    The result contain the highest node id 367A8DAFACEE16E7E10000009B38F976, which stands for "SAP Business Parnter" (according the table TNODEIMGT-NODE_ID).
    But the fact, that "SAP Business Partner" is in "Cross-Application Components" is unreachable for me.
    Do you know, how to get relevant node on level 02 ?
    All hints will be rewarded.
    Thank you
    Regards
    Tomas

  • How to get path to file variable with applescript

    I've tried:
    `set file_path to path of myfile`
    but it's giving me error:
    `error "Finder got an error: Can’t get path of document file ..."`

    Code is:
    set theFolder to (choose folder with prompt "Select the start folder")
    set file_list to every file of theFolder
    repeat with myfile in file_list
        set file_name to name of myfile
        set file_path to path of myfile
        log (file_path & "/" & file_name as string)
    end repeat

  • How to get path or parent folder

    Hello
    I'm overriding method extendedPreAddRelationship on class S_Relationship.
    My purpose is to check whether the document is being put in the correct path or not.
    I can get folder name and document name using following code:
    AttributeValue av;
    av = def.getAttribute(Relationship.LEFTOBJECT_ATTRIBUTE);
    S_PublicObject folder = (S_PublicObject) av.getPublicObject(this.getSession());
    av = def.getAttribute(Relationship.RIGHTOBJECT_ATTRIBUTE);
    S_PublicObject document = (S_PublicObject) av.getPublicObject(this.getSession());
    What I need is the whole path (or at least the parent folder). Can I get path somehow? Or should I try to search parent folders?
    Jaska

    My purpose is to check whether the document is being put in the correct path or not.Hi,
    I had a similar problem - I needed to compare the path of current folder with path from parameters. Because I wasn't be able to get the path of folder, I did it in reverse way, comparing the folders. To get folder from path I needed getRootFolder method, which wasn't in server-side classes, so I extend S_TieFolder class:
    * Analogy of LibrarySession.getRootFolder().
    public static S_Folder getRootFolder(S_LibrarySession session)
    throws IfsException
    S_Folder folder = null;
    try
    Collection c = session.getValueDefaultCollection();
    S_ValueDefault vd = (S_ValueDefault)c.getItems("RootFolder");
    AttributeValue av = vd.getPropertyValue();
    folder = (S_Folder)av.getPublicObject(session);
    catch(Exception e)
    throw new IfsException(21020, e, session);
    return folder;
    In extendedPreAddItem method of S_TieFolder:
    S_Folder paramFolder = (S_Folder)getRootFolder(session).findPublicObjectByPath(folderPath);
    if( this==paramFolder ) ...
    Radek
    [email protected]

  • How to get path of a VI used in LV project?

    How can I get the path of a VI used in LabVIEW project?
    Actually I want to replace the VI used in LV project by saome other VI, and I think it can be done if I get the path of the VI already present in project and replace that path with path of the VI which I want to include in that project.

    There are several ways to replace a VI, say "MyFirstVI", with another, say "MySecondVI".  The method you use will depend on several factors, including
    the version of LabVIEW you are running
    whether the VIs are in a LabVIEW Project or not (if they are, I'm assuming they are in the same Project)
    whether you want to replace all MyFirstVI instances with MySecondVI, or selected ones
    the size (number of VIs) of the Project.
    As noted, if you want to replace all of MyFirstVI with MySecondVI in a Project, here is one way to do this:
    Close the Project.  You do not want to do this with Project open.
    Rename MyFirstVI to MyOldFirstVI.
    Rename MySecondVI to MyFirstVI.  If MySecondVI already exists in the Project, you might want to Copy it instead of Rename.
    Open the Project.  Find and open an instance of MyFirstVI, verify it has the code of MySecondVI.
    In Project Explorer, find MyFirstVI and rename it MySecondVI.
    Exit Project.  Rename MyOldFirstVI back to MyFirstVI.
    At this point, all of your VIs have their "original" names, but in, say, Main.vi, wherever MyFirstVI was called, you should see MySecondVI.
    For doing selective Replacement (or even total replacement where you want to actually see all of the instances where replacements are made), you can use QuickDrop to your advantage.  You need to have in memory the VIs that use MyFirstVI, and also have MySecondVI in memory.  With the Project open and the relevant VIs in memory:
    Open any VI that shows MyFirstVI on the Block Diagram.  Right-click it and choose "Find All Instances".
    When the search is done, you need to "visit" each of the found VIs -- use Ctrl-G to do this.
    When you find an instance of MyFirstVI, type Ctrl-Space to activate QuickDrop, start typing MySecondVI until it appears on the Selection line (if you are lucky, you will only need to type MySec and it will find the correct VI), then type Ctrl-P to replace MyFirstVI with MySecondVI.
    Type another Ctrl-G to go to the next instance of MyFirstVI and replace as needed.  When you've replaced all of them (or all that you want to replace), stop.
    Bob Schor

  • [CS4] How to get path from SPPlatformFileSpecification on mac ?

    Hi all,
    sADMBasic->StandardGetDirectoryDialog() return the directory selected by user in SPPlatformFileSpecification type variable.
      when I select the any directory i.e desktop SPPlatformFileSpecification  structure contains the following  values--
    short vRefNum =  -100
    long parID        =   371658
    unsigned char name[64] = '\0'
    is there any API or alternatives which give the path as char or string like -  "/Users/User1/Desktop" from these values?
    thanks
    D.A

    Try this:
    SPPlatformFileSpecification spec;
    // do sADMBasic->StandardGetDirectoryDialog()
    ai::FilePath path;
    sAIFilePath->SetFromSPFileSpec(spec, path);
    Then talk to path to get your location. Hopefully that does the job. I've never used StandardGetDirectoryDialog() though, so for all I know its broken.

  • How to get path of image from server side in form of URL

    Hello,
    I want to access images stored on server side local folder. How do I create a URL for that. Images in the folder changes dynamically, so I should be able to display the new modified images. Please help me.
    Thanks in advance

    Are you asking from client side to access server (local folder) images...
    if yes
    where the security goes....
    please be in detail...

  • How to get path and disc capacity in Finder

    Hi!
    Lion seems fine for me ... but I can't see the drive capacity / free space which was previously at the bottom of each finder window.
    Any ideas where it is?  I can't see an option to turn it on, anywhere!
    Many thanks

    Ummm...
    View menu --> Show path bar, Show Toolbar, Show Status Bar

  • How to get path to windows

    Hi, I need to locate the path to windows. I've found somewhere this instruction but it always returns null. This is what I have:
    System.getProperty("com.ms.windir");
    Any help please.
    Roel

    Just 'cos its deprecated doesn't mean you can't use it, and it certainly doesn't throw an exception - it just displays a warning when you compile it.
    I've just done a quick check on System properties, and there isn't one for Windows directory. Abnormal's suggested method is cheating a bit - you're telling it what the directory is, rather than looking it up.
    So I'm afraid it's either using getenv, or third party tools (the latter is preferred, as long as they're free!)
    Robin

  • How to get object-path at runtime

    Hi, In my application paths of particular controls(radio buttons and links) get changed at runtime. Therefore I cant access those objects. It would be helpful if somebody guide me how to get paths of objects(controls) at runtime. To be more specific following are the paths procured on different time ie. on different runs.
    "window(name='incident173747')[1].window(name='ifrmTabWindow')[1].input(name='generateQuote')[1]"
    "window(name='incident173750')[1].window(name='ifrmTabWindow')[1].input(name='generateQuote')[1]"
    One can see only first window name is changed here.In first case it is :
    name='incident173747'
    while in the second one it's:
    name='incident173750'

    Hi Vivek555,
    How do you know which radio button or link you want to click on? If each one is called generateQuote, what is in on the page that says "This is the one I want to click on".
    Please give a snippet of the html for the page so that we can help you out.
    Thanks,
    Kevin Gehrke
    Empirix, Inc.

  • Get path to nodes by value

    Can enybody please help me. I don't know really how to get path from xml
    for example, this is xml:
    <?xml version="1.0"?>
    <purchase_order>
    <po_items>
    <item>
    <name>#Name#</name>
    <quantity>#number#</quantity>
    </item>
    </po_items>
    </purchase_order>
    and get out path by variebles #Name# and #number#.
    In this case i need to get result:
    purchase_order/po_items/item/name
    and
    purchase_order/po_items/item/quantity

    Pitty you did not mention your db version.
    putting together some functions from FunctX one can write
    SQL> with t as (
    select xmltype('<?xml version="1.0"?>
    <purchase_order>
    <po_items>
    <item>
    <name>#Name#</name>
    <quantity>#number#</quantity>
    </item>
    </po_items>
    </purchase_order>') xml from dual
    select x.*
      from t t,
      xmltable('declare function local:index-of-node  ( $nodes as node()* ,  $nodeToFind as node() )  as xs:integer*
                       for $seq in (1 to count($nodes))  return $seq[$nodes[$seq] is $nodeToFind]
                   declare function local:path-to-node-with-pos  ( $node as node()? )  as xs:string
                       fn:string-join( for $ancestor in $node/ancestor-or-self::*
                                              let $sibsOfSameName := $ancestor/../*[fn:name() = fn:name($ancestor)]
                                           return fn:concat(fn:name($ancestor),
                                                                   if (fn:count($sibsOfSameName) <= 1)
                                                                   then ""  else fn:concat( "[", local:index-of-node($sibsOfSameName,$ancestor),"]"))
               element e {local:path-to-node-with-pos(//item/name[. = "#Name#"]), element name {//name}},
               element e {local:path-to-node-with-pos(//item/quantity[. = "#number#"]), element name {//quantity}}'
               passing t.xml
               columns value varchar2(50) path 'name',
                            path varchar2(50) path 'text()'
               ) x
    VALUE      PATH                                   
    #Name#     purchase_order/po_items/item/name      
    #number#   purchase_order/po_items/item/quantity  
    2 rows selected.

  • How to get the current path of my application in java ?

    how to get the current path of my application in java ?
    thanks

    To get the path where your application has been installed you have to do the following:
    have a class called "what_ever" in the folder.
    then you do a litte:
    String path=
    what_ever.class.getRessource("what_ever.class").toString()
    That get you a string like:
    file:/C:/Program Files/Cool_program/what_ever.class
    Then you process the result a little to remove anything you don't want:
    path=path.substring(path.indexOf('/')+1),path.lastIndexOf('/'))
    //Might be a little error here but you should find out //quickly if it's the case
    And here you go, you have a nice
    C:/Program Files/Cool_program
    which is the path to your application.
    Hooray

Maybe you are looking for

  • Open VI's front panel

    Hi, See the included file 'Printing.bmp'. I am printing a VI's front panel, but before printing I want to open another VI's front panel that is showing the message 'Printing...'(P'ting). This VI's front panel should be closed after printing. But the

  • Item based security on List

    Hi, I have a list with 3 columns Column Name| Column Type Employee | Person/Group First Name | Single Line Text Last Name | Single Line Text As the Employee column is of type "Person/Group", I want to apply item based security on this list. For examp

  • Pattern fills with seamless patterns

    Hi, I'm doing some shapes that have a seamless pattern fill & then I want to use the shapes with the sealess pattern fill in another seamless pattern.  The only way i see I can do this is by expanding the artwork before dragging it into the swatch pa

  • OS upgrade/maintenance

    I am about to back up all my data from internal and external drives. To do so, I need to get a new DVD burner, for my old G4dual450. There is one newer burner that is custom made for this machine, but it is not compatible with my 10.2.3 OSX. Tiger is

  • FI error while release to accounting

    While doing PGI release to accounting button is there from which accounting entry is hit. But I m getting an error which is as follows:- When release to a/c commercial invoice by VF02 tranjections then following error is coming. Balance in transactio