How Can I get the Jar file path ?

I have an aplication in a Jar file. This application might be situated in any directory.
I would like to know programatically the path where it was installed.
Is there any way to know this simple thing in Java? I cannot believe that there is not a function like System.getProperty("user.dir") for this as System.getProperty("user.dir") will always return the directory from where the Java VM was lauched!
Thank you!

You can get the location with:
URL codeBase = getClass().getProtectionDomain().getCodeBase().getLocation();But as has been pointed out, it's probably better to specify the directory to store these files some other way, e.g. use a batch file or shell script to launch your program and make it the cuirrent directory, or put the directory in as a property or command argument.

Similar Messages

  • Teststand 1.03 - How can I get the sequence file path into an expression?

    The sequence file will be located at different locations on different computers. I need the base address of the sequence file to get to the correct limits file. How can I get the sequence file path into a string-local expression.
    Thanks

    As Ray described, the FindFile expression function and TS API method will seach all TS search directories and return to you the path of your file, assuming the file is located in the search directories.
    If you just want the path of a TS file that you have a reference to then there is a faster, easier method. You can use the Path property of the PropertyObjectFile class. In the attached example I use an AcitiveX Automation adapter step to call Path on the property RunState.SequenceFile. This returns the path to the current executing sequence file. Note that if you have not yet saved the sequence file then the path will be empty. In a subsequence step I strip off the file name leaving the root path of the file.
    Attachments:
    GetSeqFilePath.seq ‏22 KB

  • How can i get the document full path in S_TieDocument?

    I create a new S_TieDocument and override 2 methods:
    extendedPreInsert and extendedPostInsert
    how can i get the document full path in these 2 methods?
    (e.g. if i use the system user to upload a new file named 'test.file' in system root path /home/system, and i want to get the document full path '/home/system/test.file', how to get it?
    anybody know it, pls tell me, thanks a lot.
    java source is as below
    package oracle.ifs.server;
    import oracle.ifs.beans.Document;
    import oracle.ifs.beans.DocumentDefinition;
    import oracle.ifs.beans.LibraryObjectDefinition;
    import oracle.ifs.beans.LibrarySession;
    import oracle.ifs.beans.PublicObject;
    import oracle.ifs.common.AttributeValue;
    import oracle.ifs.common.IfsException;
    import oracle.ord.itech.cmsdk.ws.view.EmbeddedCMSDKWebServicesWSStub;
    public class S_TieDocument extends S_Document
    public S_TieDocument(S_LibrarySession session, S_LibraryObjectData data)
    throws IfsException
    super(session, data);
    public S_TieDocument(S_LibrarySession session, java.lang.Long classID)
    throws IfsException
    super(session, classID);
    // Overrides
    public void extendedPreInsert(OperationState opState,
    S_LibraryObjectDefinition def)
    throws IfsException
    // Always call super
    super.extendedPreInsert(opState, def);
    // Get the LibrarySession
    S_LibrarySession session = getSession();
    def.setUserSetAttribute("CUSTOMATTRIBUTE",
    AttributeValue.newAttributeValue(""));
    //how can i get the document file full path here?
    public void extendedPostInsert(OperationState opState,
    S_LibraryObjectDefinition def)
    throws IfsException
    // Get the LibrarySession
    S_LibrarySession session = getSession();
    //how can i get the document file full path here?
    }

    In the new version of Numbers this option is not available.  You will have to type the file name into the header yourself.  You can post feedback to Apple using the menu item "Numbers > Provide Numbers Feedback"
    or use Numbers2.3 which should be in the folder "/Applications/iWork '09" if you previously had it installed

  • :-)  How can we change the default file path for Bank file ( dmee ) ?

    Hi All,
    We encounter a problem.
    Electronic bank file ( created after a F110 run ) are created, in an automatic way to the DIR_TEMP directory. ( On the SAP server )
    How can we change the default file path for Bank files ( dmee ) ?
    We'd like to specify another path.
    Thx for your help.
    Erwan

    Hello,
    Make sure that you have created the directory in transaction code AL11 with the help of basis consultants.
    You can link your PC directory to the application server.
    You can maintain the path whether your file needs to get saved in OBPM4 against your DMEE structure example GB_BACS etc.
    If you do not maintain any path in OBPM4, then the file gets saved to temporary directory. If you give the directory path name in OBPM4, then the file gets saved to that directory with numbers 0001, 0002, 0003 etc till it reaches 9999 and reset from the beginning.
    If you give the path as well as file name as ABCD, then the file gets generated to that directory folder with ABCD0001, ABCD0002, ABCD0003 etc. till it reaches ABCD9999 and reset from the beginning.
    Hope this solves your problem.
    Regards,
    Ravi

  • Exporting photos for UHDTV or Native 4K TV, what are the best settings ? (File: Quality File: Color Space, Image Sizing and resolution)   Or in other words; How can I get the smallest files but keep good quality for display on new UHDTV

    Exporting photos for UHDTV or Native 4K TV, what are the best settings ? (File: Quality File: Color Space, Image Sizing and resolution)   Or in other words; How can I get the smallest files but keep good quality for display on new UHDTV

    You're welcome, and thank you for the reply.
    2) Yesterday I made the subclips with the In-Out Points and Command-U, the benefit is that I've seen the clip before naming it. Now I'm using markers, it's benefit is that I can write comment and (the later) clip name at once, the drawback is that I have to view to the next shot's beginning before knowing what the shot contains.
    But now I found out that I can reconnect my clips independently to the format I converted the master clip to. I reconnected the media to the original AVI file and it worked, too! The more I work with, the more I'm sold on it... - although it doesn't seem to be able to read and use the date information within the DV AVI.
    1) Ok, I tried something similar within FCE. Just worked, but the file size still remains. Which codec settings should I use? Is the export to DV in MOV with a quality of 75% acceptable for both file size and quality? Or would be encoding as H.264 with best quality an option for archiving, knowing that I have to convert it back to DV if I (maybe) wan't to use it for editing later? Or anything else?
    Thank's in advance again,
    André

  • How can I get the lesson files for Aperture 3.2.4?

    How can I get the lesson files for Aperture 3.2.4?

    They are only available on the original Installer dvd with the boxed retail version.
    But you can easily use your own photos to try out the tutorial videos. The videos are linked on the Aperture Support page.

  • When I move a RAW file from IPhoto to my desktop or Photoshop it changes to a jpeg and reduces in size. How can I get the Raw file across?

    When I move a RAW file from IPhoto on my macbook pro to desktop or Photoshop it changes to a jpeg and reduces in size. How can I get the Raw file to move across?

    I create separate folders based on the year and then the actual date of when I take images. You can make those folders anywhere on any hard drive that is connected to your Mac whether internal or external. I also use the Photoshop Photo Downloader that is included with Photoshop/Bridge and it will create the date folder so all I do is create a Year folder.
    Open Bridge or click on the Bridge icon in PS and in the File menu item in Bridge select "Get photos from Camera". It can be a camera connected to your Mac or a memory card from a camera. A window will open and you then select the camera or memory card. Set the location they will be downloaded to, just the folder and you can Browse to a folder that you created, then in the "Create  Subfolders drop down select what date stamp you want to use or or custom name or not to create subfolders at all.
    I've never cared for iPhoto one bit. I tried it but found it way to restrictive. It likes to have full control over how you interact with your images.

  • How can i get the trace file

    Hi,
    I wanted to check the trace file to make sure that there is no login attempts happend through the forms with wrong username and password.
    how can i enable the trace file , where i have to write the commands and where i can see the trace file.
    I'm using oracle forms 6i
    could anybody help me.
    thanks
    Bcj

    This link is all about forms 9i, i'm working on forms 6i. but i have tried with following values
    TRACE_LEVEL_CLIENT=16
    TRACE_UNIQUE_CLIENT=TRUE
    TRACE_FILE_CLIENT=Test
    TRACE_DIRECTORY_CLIENT=c:\orant\net80\trace
    in sqlnet.ora file and it created a trace file whenever it connected to database through the on_logon trigger.
    if the username or password is invalid then the validations raise the form_trigger_failure exception. so there was no trace file. so i was unable to get the trace file to see the invalid login attempts.
    Thanks

  • I lost all of my document saved in my previous adobe after I upgrade the itunes, how can I get the lost file?

    I Lost of my document saved in my previous adobe after upgraded itunes, can I get the lost file again?

    Would you provide more information so that we can troubleshoot the problem?
    Are you saying that your PDF documents on your iPad/iPhones are lost because you updated Apple iTunes (not Adobe Reader)?  Do you see anything in the Documents or Recents section of the Adobe Reader home screen?

  • How can I get the full VI path of a step?

    I can get the VI file name by with Step.TS.SData.ViCall.VIPath but is it possible to get the full path?
    CLD (2014)

    Hi,
    TestStand uses relative paths, so it never actually stores the full path to the VI unless you specify an absolute path.
    If you would like to find the full path of where it has been found, you can use the method Engine.FindFile or the expression function FindFile to find where TestStand is locating this file.
    Matt M
    NI

  • How can I get the lib files which supported jsf?

    In one book , That introduce me to get the lib files from a jsf folder ,after you install the jwsdk1.3 ,now ,I installed the 1.5,but I cann't find this jsf folder.where I can get these lib files ? Thanks very much.

    Try data rescue or some other program. However, before proceeding turn off TM and avoid that muck up the next time you connect. AFAIK, however, it shouldn't have happened without a dialog box popping up allowing you to not use it for TM.
    See Pondini's TM FAQs for more information..

  • How can I get the server absolute path of virtual directory?

    Problem context:
    absolute path of my application at JRUN server is
    c:\testing
    nd url is
    http://kaspak/test
    ( kaspak is a machine local to server i-e client nd server r at same machine )
    I m uploading a file nd saving it at server.
    PROBLEM:
    server save my uploaded file at
    C:\Program Files\Allaire\JRun\servers\default
    [ a path where server is installed ]
    while I want to save it at directory
    c:\testing\uploadfiles
    How can I achieve this???
    waiting for quick reply..
    KasPak

    here is a function for which u said,
    protected void readAndSaveFile(MultipartInputStreamHandler in,
    String boundary,
    String filename,
    String contentType) throws IOException
    A utility method that reads a single part of the multipart request that represents a file, and saves the file to the given directory. A subclass can override this method for a better optimized or differently behaved implementation.
    again saving a file, or uploading a file is no problem,
    but saving a file at our desired location,
    nd this can only be done if we know reall/absolute path of our application at server,
    i-e we need an API which can tells the absolute path of our application.
    e.g
    our application url is http://kaspak/testcode
    we need its absolute mapping to directory on server
    e.g it it is at c:\testcode
    if we get the absolute path then we can pass it in above function or in File class constructor.
    isn't it??
    I think in this way i can save file at other location.
    But how i can get absolute path?????
    thanks for ur reply,
    nd waiting for ur reply again.
    wbw
    kaspak

  • How can I get the jar location of a class (the -Xbootclasspath case)?

    Hi
    I'm using -Xbootclasspath/a to append a jar into the "ring 0" of VM. Inside my class, I want to find out the location of the jar so that I can find other resources that's deployed along with it. How can I do that? I try the standard getProtectionDomain().getCodeSource().getLocation() way but it seems a class in bootpath returns null at the second method.
    Currently I have to manually feed the path into the app using an environment variable, but I'd like to know if there's a better solution.
    Thanks
    Weijun

    This is not exactly the answer that you are looking for but If your are interested into the BOOTCLASSPATH value, you can get it with JMX.
    RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();
    System.out.println("BOOTCLASSPATH:\n"
         + mx.getBootClassPath());Bye.

  • How can I change the log file path instead of storing log in server.log

    Hi,
    I have created one domain and modified the attribute "log-file" in element "virtual-server" element to point to the new log file path.
    But when I start up my domain, it still saying: "Log redirected to DOMAIN_LOCATION/logs/server.log.
    Why?
    Why it doesn't log to the file I specify? How can I change it?
    Thanks.
    Ken

    I have changed the logging option to my specific path in admin console as what you said. I have also changed the logging in domains attribute too.
    But still there is some logging info in domains/<dom_name>/logs/server.log instead of the path and file I specified.
    Is it possbily related to linux user role setting? the Sunone AS is installed and configured by root user. But the domain is created for another user, hence I want to forward all logging info to that user's home path.

  • How can i find the jar file version in Solaris

    Hi,all.
    I just forget the java command by which i can know a jar file's version.I searched the jar command manual,unfortunately there is nothing helpful.
    Can anyone tell me what should i do?
    Thanks in advance.

    I'm not sure that there is any version information related to a JAR file. And if you look at the JAR classes in the API docs, there is nothing related to the version. There can be a version number in the MANIFEST though, but not related to the JAR itself.

Maybe you are looking for

  • BPM Web Based Process Modelling

    Hi Folks, I remember seeing a webminar or a video on SDN which demonstrated modifying of BPM projects from within Internet Explorer. I cannot seem to find it now. If anyone else seen it or can point me to the link or can tell me which version it is i

  • SDO_NN and SDO_WITHIN_DISTANCE return distance on way or on straight line?

    Hi to all, I want ask you if the distance between 2 points computed with SDO_NN and SDO_WITHIN_DISTANCE is a distance on the way that connects these two points (for example 35 miles) or is a distance on a straight line that connects these two points

  • TS4079 Can't get siri to speak!  Siri answers in print only.  What's wrong?

    I can not get sound from Siri.  Help!

  • Restored IPhone won't sync

    Hello, About a week ago I restored by Iphone 3GS, now being used solely as a mobile media player in order to hopefully alleviate some of the lagging that I had noticed. The restore went without a hitch and after plugging it back in I attempted to re-

  • Help Diagnosing Kernel Panics (MBP 8,2 on ML)

    Hello all, I'm hoping you can help me resolve these kernel panics on my Early 2011 MacBook Pro. They occur regardless of whether or not there is any external hardware attached, so we probably can rule that out straight away. In fact, they primarily s