How to get the current path/directory

Hey,
I was wondering how to figure out the current path or directory where my Application is running (stored) in! I know there is a statement like getCodebase() for Applets to get the actual path, but I couldn't find anything similar for regular Applications. I think I can not just use a absolute path, since it might run on different os with different file seperator (like /root or c:\). Any help is welcome!
Thank you very much,
Marc

Try this ...
        System.out.println("current directory = " + System.getProperty("user.dir"));
[/code}                                                                                                                                                                                                                               

Similar Messages

  • 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

  • How to get the current path in an application?

    i don't mean in the applet, i know i can use getCode() there, but how can i do the same thing in an application?
    should i use ClassLoader.getResource(String)? but i don't know how to use it, what does the parameter String mean?

    Start reading here:
    http://java.sun.com/j2se/1.4.1/docs/api/index.html
    Try looking at classes in the java.io.* package. You will probably be interested in things like Reader, InputStreamReader, BufferedReader. Other classes which might be helpful are:
    java.lang.StringBuffer
    java.net.URL
    All of these things are documented at the above link -- it's an invaluable resource. If you find things you don't understand about these classes, then consult your book, search the internet, and search this forum. If none of that helps, THEN post a specific question to this forum (and no sooner).

  • How to get the current executing file/itself absolute directory?

    hellooo,
              gentlemen/lady, how to get the current executing file/itself absolute directory?
              thanks
              

              Hello,
              you can get the real path information of the JSP through the servlet context:
              http://java.sun.com/products/servlet/2.2/javadoc/index.html
              javax.servlet
              Interface ServletContext
              Method getRealPath
              Christian Plenagl
              Developer Relations Engineer
              BEA Support
              [email protected] (alex mok) wrote:
              >hellooo,
              >
              >gentlemen/lady, how to get the current executing file/itself absolute
              >directory?
              >
              >thanks
              

  • How to get the current application root directory

    Hi Experts,
    I am deploying an ADF Application to a Standalone WLS 10.3. During development I am using Integrated WLS (which comes with JDeveloper 11.1.1.5.0). During development, I configured my application to create log files in my local machine (where Integrated WLS is running) by using absolute path for my log file. Now, I am moving to a standalone instance of WLS for testing (before moving to production).
    Now I need to keep my log files under my application root directory. Please let me know how to get the absolute path of the deployed application root directory from WLS ENV/System property into my application's Java Code.
    I tried the below java code,
    Current weblogic server name is: " + System.getProperty("weblogic.Name") --> This gives me the name of the server where my application is running.
    Current weblogic server name is: " + System.getProperty("weblogic.Root") --> This returns NULL. How to get the Root directory of my application using some system property inside my application at runtime??
    Thanks
    Rathnam

    One method is to create a File(""); and do getPath() on it.
    At least it's worked for me.

  • How to get the current filename and & or path

    How can I get the current path or filename?
    I didn't really find any answers in the net. this.path or app.path were suggested but I couldn't get it to work.
    Thanks in advance for your answer!
    Livecycle Designer ES 8.2.1.3144.1.471865

    Hi,
    event.target.path.toString();  will give the full path including the filename.
    event.target.documentFileName.toString();  will give the filename only.
    Good luck,
    Niall

  • How to get the current FILE PATH?

    I want to get the File Path on my Java Programming, which class / method can get a File Path on the windows?
    thanks!

    I want to get the current working directory(e.g.
    c:\Tomcat5.0\webapps\)
    If this is a web application you're talking about and you want the directory where that application is installed, that's almost certainly not the CWD. It might be one of the context or whatever variables that's available to servlets. Look in the servlet API and see what's there.

  • How to get the current directory as File object

    Hi guys,
    i want to get the current working directory as a file object.
    plz help me on that if there are any standard methods present for this.

    new File(".");

  • How to get the absolute path of a file from the local disk given the file n

    how to get the absolute path of a file from the local disk given the file name

    // will look for the file at the current working directory
    // this is wherever you start the Java application (cound be C: and your
    // application is located in C:/myapp, but the working dir is C:/
    File file = new File("README.txt"); 
    if (file != null && file.exists())
        String absolutePath = file.getAbsolutePath();

  • How to get the "current date" in the BEx?

    Hi all,
    I need to get the "current date" in my Bex report in order to make a comparison. I know there is a "How to" which shows how to get the current date via a User Exit, but I didn't find it. Could you please help me?
    Thanks

    1. Create a  New Formula in Key Figures structure
    2. Give tech name and description and Select "New variable" option
    3. Next screen will launch Variable Wizard -> create a new variable with replacement path as processing type
    4. in next screene  select the date characteristic that represents the first date to use in the calculation (From Date)
    5. In the next  screen select Key in the Replace Variable with field. Leave all the other options as they are
    6. In the next Currencies and Units screen select Date as the Dimension ID.
    6. Save variable
    repeate the Above steps to create another variable (To Date)
    and now you can use these two new replacement path variables in your new formula.
    Dev

  • How to get the current tree element (node/childnode/childnode/...) ?

    Hello!
    I'm trying to create a kind of a navigation tree for my application.
    It should represent some elements of an XML structure and some other nodes for other options.
    The binding with the context is not a problem, I can create the tree up to all the levels I want to.
    The problem now is, that I don't know, how to get the "current tree element", when there is any action.
    For example:
    public void onActionSelect(...) {
    String test = wdContext.currentTreeNodeElement().getText();
    wdThis.wdGetContext().currentContextElement().setSelectedElement(test);
    With this method I can get the text of the "first level nodes". If I want to get the "second level node", I can do
    String test = wdContext.currentTreeNodeElement().currentChildElement.getText();
    ..and for the next levels so on.
    Isn't there any general method to get the information of the selected element without knowing before, whether it is a nodeElement or a nodeElement.currentChildElement or a nodeElement.currentChildElement.currentChildElement, ...?
    Greetings,
    Ramó

    Hi,
    if you following that pdf ,
    i think your not implemented the below code in DomodifyView method
    if (firstTime) {
          IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TheNode");
          /* The following line is necessary to create parameter mapping from parameter "path" to parameter "selectedElement".
    Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
    that raised the onAction event. Parameter "selectedElement" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
    that handles the onAction. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
    be accessed within the event handler
          treeNode.mappingOfOnAction().addSourceMapping("path", "selectedElement");
          /* The following line is necessary to create parameter mapping from parameter "path" to parameter "element".
    Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
    that raised the onLoadChildren event. Parameter "element" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
    that handles the onLoadChildren. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
    be accessed within the event handler
          treeNode.mappingOfOnLoadChildren().addSourceMapping("path", "element");
    please cross check once.
    Thanks,
    Ramesh

  • How to get the ablolute path of the web application in WebSphere?

    How to get the ablolute path of the web application in WebSphere?
    For example:
    I have installed IBM WebSphere on D:\WebSphere\Appserver, and I created a new appliction named "myapp" on D:\myapp,. How can I get the absolute path of application "myapp"? In other words,how can I get the absolute path of the application's
    root directory?

    In the WebSphere(default), what directory is the Java Bean's root directory ?

  • How to get the full image directory when i upload the image to web page???

    hai, how to get the full image directory when i upload the image to web page???
    here is the example:
    <form action="uploadfile.jsp" method="post">
    image<input type="file" name="image" />
    <input type="submit" value="submit"/>
    <%
    String s=request.getParameter("image");
    %>
    <%=s%>
    </form>
    i upload the image from C:\image\center.gif. i use request.getParameter just can get the image name like "center.gif". Can anybody help me how to get the full path name. Thanks a lot..

    There is no need to get the path. It is also fairly pointless as the server cannot access the client's local file system.
    Carefully read this article how you can upload files the right way: http://balusc.blogspot.com/2007/11/multipartfilter.html

  • How to get the application path?

    Does some body know how to get the application path in Java? Here is an example about what I'm thinking: Let's imagin the application is on "c:\try" or "c:\ProgramFiles\MyApp". My question is how can I find the path where the application is. Please give an example if you know the answer. Thank you so much.

    Those two replies give you some useful directories, it's true, but maybe not what the OP asked. However the OP asked for something that doesn't have a meaning (applications don't have to be "on" any directory, whatever that might mean).
    Would the OP like to describe what the actual problem is here?

  • How to get the absolute path of logicalhost server domain on Windows Sun

    i am reading a file from Xsql Folder, that is located in the logicalhost Sun\AppServer\domains\domain1\applications\j2ee-apps.(IN Sun Application Server)
    I am pretty sure that using the absolute path will solve this issue, so my first question is: How to get the absolute path of logicalhost server domain on Windows?
    i tried with System.getProperty("com.sun.aas.instanceRoot").
    but i am able to retrive Sun\AppServer\domains\domain1 upto this .i am unable to retrive Sun\AppServer\domains\domain1\applications\j2ee-apps.
    please suggest me how u can get absolute path in sun application server

    Take a look here

Maybe you are looking for

  • Frames with link to Struts do not render before mouse over in IE 7.0?

    Hi We have troubles with frames with link to Struts, which do not render before mouse over in IE 7.0? The application works fine with Firefox 2.0 and Internet Explorer 6.0, we have analyzed the cause to be whenever you refer to a struts 1.0 action in

  • Headphone amp for use with i-mac

    Hi, Im looking for a headphone amplifier for use with my i-mac and logic 9, im using a pair of sennheiser HD 650's, can anyone recommend one? Thanx...

  • Help needed in SAP SD

    Hi all gr8 guns here, I am very new to  SAP SD, prior i have experience of SAP Variant Configuration. Can anybody please help me how to excel in SAP SD as i have an engineering with computer science. Also please suggest some excellent books in SD.

  • Incorrect Financial Statment Item

    Hi experts, I use the standard report in BI content : 0FIGL_VC1_Q0001 (Financial Statement and P&L: Actual/Actual Comparison) . I have loaded Financial Statement Item Hierarchy successful. It is correct when I view in Administration Workbech (rsa1),

  • Why is Delete greyed out in the Edit menu? (track selected in regular playlist)

    Hi. Starting today, Delete is permanently greyed out in the Edit menu in iTunes. This is with tracks selected in the Music library or in any playlist (not just Smart Playlists). I manage tracks daily, and this just started today. I upgraded to 10.4 a