How to now the Current Directory

Hi everyone, i have a little problem, i dont'n know how to get the name of the current directory where i have the .jar file of my applet, and i need to know which is this directory to do something on it.
How could i know the current directory?...
Thanks.

Hi.
You can not get the current directory: applets can not access the hard drive. Instead you can get the code location, which will given the current directory if running locally.
Try this: within the applet do : getCodeBase(). This will give you an URL to the code of the Applet, that is the JAR file.
Hope this helps,
Nuno

Similar Messages

  • How to get the Current Directory

    Hi,
    I need to tell the system to read a file in my current directory. How do I tell the system what the current Directory Path is
    Thankx in advance...

    It depends on the current working directory from which you start your JVM.
    From DOS or UNIX shell this is the directory where you have come by "cd".
    On Windows you can do the same from Explorer or other file managers: the directory where you are when starting JVM.exe.
    If you define shortcuts - e.g. on the desktop -, you specify it there as the "working directory".
    You can retrieve this directory by
    System.getProperty( "user.dir" )
    Now with File classes:
    Each file name without path will be interpreted as being in this directory.
    Absolute paths are clear.
    But you can't mix this:
    If you specify "test/debug.ini" or "test\\debug.ini" from debug directory: false!
    If you specify "../debug.ini" or "..\\debug.ini" from debug/test directory: false!
    Do it this way:
    Start from debug directory.
    So you can access file debug/test/debug.ini as
    System.getProperty( "user.dir" ) + "/test/debug.ini"
    Works?

  • How to know the current directory

    Could somebody write me an example to print the current directory I'm working on.
    e.g.
    java A
    d:\My Documents\source\A.java
    Thank you.

    Could somebody write me an example to print the
    current directory I'm working on.
    e.g.
    java A
    d:\My Documents\source\A.java1. This is not a directory
    2. A.class will be run, not A.java
    3. You'Ll never know where your sourcecode is
    4. Where your program thinks it is can be determined using
    new File(".")

  • 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 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 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
              

  • 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

  • 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 Workitem id at runtime

    Hi All,
    I have a scenario, where request pending with a user who has already resigned the organization. The requirement is that we need to provide a report
    of the request and with whom it is pending with along with the workitem id with a forward push button.
    So that if the user identifies that a request is pending with someone he can click the record and press for the forward button and a pop-up to be showed where he can enter the userid to whom he needs to forward it.
    In this scenario can anyone tell me how to get the current workitem id at run time and to save it to a custom table.
    I tried with method before workitem execution, but here i am not getting the current workitem id.
    Can you please suggest a good solution for this.
    Thanks and Regards,
    Balaji

    Karri,
    I think i can explain you with an example.
    Here is my Scenario.
    A user has raised a Gate pass and it went to all approval's and got approved and the material is also sent out from the plant. Lets take the date as 1.1.2013 (A Warehouse person have done the checking and sent out of the plant).
    On 1.3.2013 some of the material has been returned and a material inward request has been raised and now the warehouse person has to do a inward checking and to sent it back for the initiator for the approval, but the warehouse person has resigned the organization on 1.2.2013, now the workitem is pending with the warehouse person who has already resigned.
    My scenario is once the material inward request is created and before the workitem is delivered to the warehouse person i need to get the workitem id and to store the workitem some where.
    So that in future if any warehouse dept head wants to forward the workitem which are lying in the person inbox who has already resigned he can do it via a report using this workitem id.
    So, can anyone help how to get the dialog workitem id before the workitem creation or execution. I tried with "method before workitem execution" but my break point is not triggering at this point.
    Thanks and Regards,
    Balaji

  • 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 current node element by its value?

    e.g,:
    wdContext.current<b>Deal</b>Element().setAttributeValue("<i>deal_id</i>","<i>aaaaaaa</i>");
    above code can get the result i wanna.
    but now i wanna in terms of its node'name to  set attribute vaue of itself. in other words,i have no idea about how to get the current node element by its name"<b>Deal</b>".

    Hi Wing,
    The answer is there in your question itself.
    wdContext.currentDealElement()
    will give you the current node element by its name"Deal" or you could use
    wdContext.nodeDeal().getCurrentElement()
    or you could use
    wdContext.nodeDeal().getElementAt(wdContext.nodeDeal().getLeadSelection())
    Regards,
    Sudeep

  • How to cooperate the current mail system with Sun Java Commnication Suite 5

    Dear all and Shane,
    Excuse me for bothering you again.
    Due to time limited, I would like to know how to cooperate the current mail system with Sun Java Commnication Suite 5. I mean I would like to use current mail system (mailscanner + postfix + courier-IMAP + clamav + spamassassin + webmail) and use the outlook connector to connect to Sun Java COMMS 5 to share the calendar, contacts only.
    Right now I have done the testing by using outlook, mac mail, thunderbird to share calendar,contacts via Sun Java COMMS 5 in Centos Linux 5.
    My plan is as following
    1. Sun Java Communication suites 5 server ( I called it comms5 ) will be in DMZ zone and will open the necessary ports in firewall.
    2. I will create more than six sub domain name in Sun Delegate server and the necessary accounts within these domain names.
    3. All messages will be transmitted via Postfix and clients will retrieve from Courier-IMAP
    4. All Clients included other branch offices will use different mail clients to share their calendars, contacts via COMMS5 ( But how will COMMS handle the messages such like invitation ? )
    Any suggestions will appreciate.
    PS: Is it possible to classify the contacts in outlook address book ?
    For example, when user click the receiver, it will show like as following
    GLOBAL ADDRESS BOOK
    --Director
    --and so on
    ----CN.BRANCH OFFICE
    -----------CN01 EMAIL ADDRESS
    -----------CN02 EMAIL ADDRESS
    -----------CN03 EMAIL ADDRESS
    and so on
    ----JP.BRANCH OFFICE
    -----------JP01 EMAIL ADDRESS
    -----------JP02 EMAIL ADDRESS
    -----------JP03 EMAIL ADDRESS
    and so on
    ----TW.BRANCH OFFICE
    and Due to the user account is located in CN.BRANCH OFFICE, it will extend the CN.BRANCH OFFICE contacts level.
    Excuse me for bad English, hope you can understand it.
    Best Regards,
    Bruce

    Dogz wrote:
    Due to time limited, I would like to know how to cooperate the current mail system with Sun Java Commnication Suite 5.
    I mean I would like to use current mail system (mailscanner + postfix + courier-IMAP + clamav + spamassassin + webmail) and use the outlook connector to connect to Sun Java COMMS 5 to share the calendar, contacts only.Getting your current mail system to 'co-operate' in this way will require more time then simply migrating the accounts of users on the current mail system to the comm-suite-5 installation and making use of UWC for Webmail access and ClamAV/SpamAssassin integration within the messaging MTA.
    Also the use of Outlook Connector with a non-Sun IMAP backend isn't supported, nor is the use of a non-Sun IMAP backend possible with UWC.
    Right now I have done the testing by using outlook, mac mail, thunderbird to share calendar,contacts via Sun Java COMMS 5 in Centos Linux 5. Once again I should remind you that CentOS is not a supported platform for comm-suite-5
    Regards,
    Shane.

  • Don't know how to calcualte the current page in smartform for second layout

    Hi All ,
       Iam creating an smart form which contains two layout in a single form. I need the page number to be displayed as followes.
    1st layout : 1 of 2
                     2 of 2.
    in 2nd layout 1 of 2.
                        2 0f 2.
    I dont have any issues in printing total number of pages. i dont know how to calculate the current page for the 2nd layout. <<text removed>>
    Edited by: Matt on Jun 25, 2009 5:09 PM - Removed ALL CAPITALS from subject

    Hi,
    Create a New window of Type 'Final Window' and Position it in the layout where u want to display the page numbers.
    Now, create a text element in the window and create the text like below in the text element.
    P1 Page &SFSY-PAGE& of  &SFSY-FORMPAGES(3CZ)&
    &SFSY-PAGE&                            - Current Page No.
    &SFSY-FORMPAGES(3CZ)&         - Total No of Pages.
    Note: dont forget to create the window type as 'Final Window', otherwise it will show ssome junk...
    Hope it helps!!
    Rgds,
    Pavan

  • How can i specify current directory path of wsusscn2.cab

    SCRIPT:
    How can i set current directory file path of wsusscn2.cab where i placed this vbscript, instead of going to c:\wsusscn2.cab.
    =======================================================================
    Dim fso
    Set wshNetwork = CreateObject("WScript.Network")
    strUser = wshNetwork.Username
    Set fso = WScript.CreateObject("Scripting.Filesystemobject")
    Set f = fso.CreateTextFile(".\Missing Patch Details\" & wshNetwork.ComputerName & "_missing_patches.csv", 2)
    Set UpdateSession = CreateObject("Microsoft.Update.Session")
    Set UpdateServiceManager = CreateObject("Microsoft.Update.ServiceManager")
    Set UpdateService = UpdateServiceManager.AddScanPackageService("Offline Sync Service", "c:\wsusscn2.cab")
    Set UpdateSearcher = UpdateSession.CreateUpdateSearcher()
    WScript.Echo "Searching for updates..." & vbCRLF
    UpdateSearcher.ServerSelection = 3 ' ssOthers
    UpdateSearcher.ServiceID = UpdateService.ServiceID
    Set SearchResult = UpdateSearcher.Search("IsInstalled=0")
    Set Updates = SearchResult.Updates
    If searchResult.Updates.Count = 0 Then
        WScript.Echo "There are no applicable updates."
        WScript.Quit
    End If
    WScript.Echo "List of applicable items on the machine when using wssuscan.cab:" & vbCRLF
    For I = 0 to searchResult.Updates.Count-1
        Set update = searchResult.Updates.Item(I)
    f.WriteLine update.Title
    'WScript.Echo I + 1 & "> " & update.Title
    Next
    WScript.Quit
    ==========================================================================
    prakash

    Just remove the c:\ and it will be looked for in the current directory.
    If you want the script how get the script path and remove the file name or use the shell
    currentFolder = CreateObject("WScript.Shell").CurrentDirectory
    ¯\_(ツ)_/¯

  • 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

  • Recovering a HP with Windows Vista

    My computer is so screwed that I feel the need to recover it. I have all the files I need backed up elsewhere besides my laptop clearly, since I am ready to restore it, but I followed the instructions that were given in the forum to restore my laptop

  • NWDS 2.0.11

    Hi, I need to install NWDS 2.0.11 version. I downlaoded/installed a file 51030724_15   NW04 SR1 SAP NW DEVELOPER STUDIO 2.0  from SAP Marketplace. But it has got a version of 2.0.9. Can anyone help me in getting this editor to 2.0.11 Regards, Gandolf

  • Help with brand new IP Phone 7941G

    I have bought a brand new phone as above. I have it currently connected to a POE switch which is fine. It has power but it is constantly saying Configuring IP in the botttom left. I am not sure how to set the correct time and date or the correct time

  • Write 2darray to file

    Hey guys, I have it writing to the file, its just it writes it all on the same line, i want to have a new paragrapgh after the first line an so on; String outFile[][] ={{"hello", totCircle1},                       {"hello", totCircle1}};             

  • IPhoto imports pictures in small resolution!

    This issue wasn't happening until a couple of weeks. When connecting my iPhone 4 to the computer and starting iPhone to import my photos, the result files are smaller than the original files. The information consigned in the iPhoto panel is that my p