Finding the current directory

within my program i need to know the current runing directory, my app. i portable and intended to be ran from usb stick and other portable media, so it will be different for each execution.
im convinced that thisis far to easy a thing for me to figure out on my own, and help would be nice.
thx

( new File( "." ) ).getCanonicalPath( )?

Similar Messages

  • There has to be a way to find the current directory in JSP, right?

    I've read a number of posts, with limited results.
    Here's my problem. I have 3 databases set up, and I'd like to use a different one depending on which directory I am in. (ie Stage, Production, Dev). So I am reading the database name from a parameter file.
    I am simply trying to read a text file from the same directory as my jsp file. For example, my jsp file is in /home/username/public_html/prod
    When I try System.getProperty("user.dir"), it returns /home/username/public_html/.
    Is there a way for the jsp page to let me know it is in the prod subdirectory? Verses another subdirectory? Everything I've tried puts me in either the /home/username directory or the home/username/public_html directory. I can't get to any of the subdirectories!!! Please help!

    This is what I'm working with right now, seems to work. Anyone know a better way:
    ServletContext context = getServletContext();
    String servletpath_str = request.getServletPath();
    StringTokenizer st = new StringTokenizer(servletpath_str,"/");
    int nooftokens_int = st.countTokens();
    nooftokens_int--;
    String virtualpath_str = "";
    for(int i=0; i<nooftokens_int; i++) {
    if(i == 0) { virtualpath_str = "/" + st.nextToken(); }
    else { virtualpath_str = virtualpath_str + "/" + st.nextToken(); }
    String currentDir = context.getRealPath(virtualpath_str);
    String filename = currentDir + "/file.txt";

  • Ctxload can't find a file in the current directory

    I am trying to load a thesaurus file using ctxload. The file is in the current directory. I can use a text editor to modify it. But ctxload always complains that "file not found." Why?

    I have the latest iTunes version and haven't seen that feature.
    From the iTunes menu bar you will find it at iTunes>Provide iTunes Feedback.
    It is also on the main iPod +iTunes page. Click on the iPod + iTunes tab at the top of this page and look near the bottom, its in small type with a pencil icon next to it.
    Hope this helps.
    bd

  • Running a java program in a directory other than the current directory

    How do I run a java program that's located in a directory other than the current directory?
    There is a file Test.java in /dir1/subdir1. If my current directory is anywhere other than that directory, say /dir2/subdir2, I can compile Test.java by using:
    javac -classpath /dir1/subdir1 /dir1/subdir1/Test.java
    But when I try to run it with:
    java -classpath /dir1/subdir1 /dir1/subdir1/Test
    I get a java.lang.NoClassDefFoundError: \dir1\subdir1\Test
    Any thoughts?

    You need to specify just the name of the class you want to run. So java -classpath /dir1/subdir1 Test

  • Issue in finding the current row

    I am rendering rows of a VO using an iterator component. One of the component I am rendering is a declarative component created by me.
    In this component there is a clickable link on which i can write any method to achieve desired functionality.
    Since, iterator is used so the current row is set to the last row. Now on clicking the link in the declarative component i need to do some operation based on the current row (pk of that row). So, how to find the current row id?
    Note: If it would be a simple adf component like a commandLink i could have inserted a setServerListener inside it and could have put the id in to requestScope to access it. But as this is the declarative component in which i cannot create a serverListener so I am looking for some other solution.

    Hi john,
    My table have the selection listener.
    Thanks in advance

  • Finding the current path

    Hey all,
    what is the shortest way to get the current directory?

    You can also call System.getProperty("user.dir"), which will return the user's current working directory as a String. Using "user.home" as the method parameter will give you the user's home directory. So if you want/need either of those directories, there's a simple 1-line way to obtain the values.
    -dSn

  • Acrobat Pro "save as" function in the file menu does not show the current directory of the file

    I have installed CC but Acrobat Pro gives me headaches.
    The "save as" function in the file menu does not show the current directory of the file but something I have worked on in the past.
    It forces me to navigates through my hard disk for this very straightforward thing in normal conditions. I precise: Acrobat is the only software reacting like that.
    I use Windows7 professional 64bits.

    I use what seems to be the latest version available on the Cloud:
    To illustrate my point, I open a directory with explorer and double-click on the only PDF in there:
    So here it is, open:
    When I do a "Save as", it takes me to a totally different place on the disk!
    Very annoying...
    Thanks for your time!
    JJ

  • How to Find the Current Instance Id in Oracle 10g

    Hi,
    how to find the current instance id in oracle 10g studio,
    I have the below code :
    if (InstanceScreenFlow.processInstance.id.id.indexOf(text : ins.id) < 0) {
    /// do something
    it is saying that "'processInstance' is not a function"
    Thanks,
    Brijesh Kumar Singh.

    Why not just pass in the "id" predefined variable into your screenflow? Once you do that you'll be able to refer to it as "id.id" anywhere inside your screenflow.
    Dan

  • How to find the current SQL

    Dear All,
    My testing engineers are checking the application from front end, i have to find the current SQL (What SQL queries are used in the application) statements in the back end.
    Please let me know how to find the current executing SQL stements.
    Thanks in advance
    Mahi

    You need to join this query with one more table - v$sqlstats. There are many statistics in particular cpu_time, elapsed_time etc stored in that table for each sql statement.
    You can join v$sqlstats by sql_id until you have multiple child cursors for single statement.
    Or you can just join to v$sql and get statistics from there and in this latter case you include child_number column to distinguish child cursors from each other.
    Best Regards,
    Alex

  • Can I find the current tab in Terminal using applescript?

    Running a script from the shell by prepending
    #! /usr/bin/osascript
    as part of my .profile, can I find the "current" tab using Applescript. Most of the time, the "current" tab will not be visible, as the shell is being initialised, or re-initialised.
    I want to set the dircolors for my shell by determining the background color of the tab in which the shell is executing.

    Under the Window menu you can activate any of the palettes that you want. In your case the Field tab is under the Object palette

  • Standard report Programs to find the current status of workflows

    Hi Experts,
                       Are there any Standard report Programs to find the current status of workflows or workflows which are pending.
    Regards,
    Hari

    Go to SWI1 t-code
    Give the appropriate Status - Ready or Inprocess or Waiting
    Input the Task - either WF Template or Standard Task.
    Choose the time period and execute the report.
    Regards,
    PR.

  • How to find the current users logged in.

    Hi,
    I have a problem in finding the current users logged into the database and the operations they are doing.
    If u know pls help me........
    Thanks.
    K.Vijay Choudary Reddy.

    hi vijay,
    this is the OracleAS Portal Content Management forum. Please post your database related question in the Database Forum:
    General Database Discussions
    thanks,
    christian

  • How to find the current state in web dynpro

    Hi,
       Can any one tell me how to find the current state of system (idle /not idle).
    Thanks,
    Krishna..

    Please explain further.  I don't understand how you are expecting to test for idle.  If ABAP code is being executed, then you know that the application is not idle. Only a server event could trigger code execution. Only a timedTrigger would be able to tell you that a certain amount of time has passed without activitity - although the event of the timer itself will be a server event that constitutes activity.

  • Where can I find the current time and date of Time Capsule?

    I have a home network consisint of 2 x Time Capsules and 1 x Airport Express.  All is working fine.  I would like to set up access control for one machine connecting to the network and I can see I can do this under Access Control on the Airport Utility.  My question is where can I find the current time and date setting for these devices? 
    I can set them to use the time.apple.com server to set the time automatically, but I can't find where to see the current time and date of the device.  The only place I can see reference to the time and date is on the logs and statistics under the Advanced tab of the AirPort Untility.

    I don't think you can change the time and date on the TC itself, it just connects to a time server (and you set your own time zone).

  • [RESOLVED] "Unable to find the current servlet" error

    Hi,
    I had a couple of ADF applications deployed to the application server, and running. I was working on adding security to a new one, and started getting the following error whenever I tried to access one of my pages after deployment:
    javax.servlet.ServletException: JAAS-OC4J: JAZNFilter.doFilter - unable to find the current servlet (full trace from the application.log below)
    I initially assumed it was a problem with the new application, but when I tried to access the older ones, which had been working, I found I get the same error. I've spoken to the app server administrator, who assures me nothing has been changed in the OC4J/J2EE area.
    I'm also getting the following error in server.log, but not at exactly the same time as the application log error, so I'm not sure it's related:
    07/11/12 17:00:05 Internal error raised trying to instantiate web-application
    java.lang.InstantiationException: No application named 'datatags' found in the server
    at com.evermind.server.http.HttpServer.getHttpApplication(HttpServer.java:705)
    at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:438)
    at com.evermind.server.http.AJPRequestHandler.initAJP(AJPRequestHandler.java:733)
    at com.evermind.server.http.AJPRequestHandler.initRequest(AJPRequestHandler.java:469)
    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:194)
    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Any ideas what might be causing this? Or where I should look for more info?
    Thanks.
    From application.log:
    07/11/12 16:48:18 MembershipApplicationView: Servlet error
    javax.servlet.ServletException: JAAS-OC4J: JAZNFilter.doFilter - unable to find the current servlet
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:253)
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
    at oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:157)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:228)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:197)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:123)
    at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:103)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Message was edited by:
    CdG

    Never mind, please ignore this entire post. I've been trying to figure out how to add security based on the JDeveloper help and some forum posts, and I'd unknowingly configured an ADF Security filter in the middle of my otherwise container-managed security. If I delete that, everything 'miraculously' starts working again.
    Sorry to have wasted your time.

Maybe you are looking for