Absolute path of a file specified in a relative path

Hello,
If I refer to a file using a relative path, what will its absolute path be? How can I change it?
Thanks.

File file = ...
String absPath = file.getAbsolutePath();

Similar Messages

  • Displaying local image file in JEditorPane with relative path

    Hi All,
    I am showing an html inside JEditorPane. I have set its content type to text/html. The code goes like this,
    StringBuffer bf=new StringBuffer();
    bf.append("<html><head></head><body>");
    bf.append("<img src=\"calendar.gif\" width=\"10\" height=\"10\" border=\"0\">");
    bf.append(" <font face=\"Verdana\" size=\"3\">");
    bf.append("Hi All");
    bf.append("</font><br>");
    bf.append("</body></html>");
    jeditorpane.setContentType("text/html");
    jeditorpane.setText(bf.toString());
    The image calendar.gif is present at the base directory of the package. But still it is not shown in JEditorPane. But if i give full path like,
    <img src="file://C:/man/calendar.gif">
    then image appears.
    Any idea like what is the document root for JEditorPane??
    Thanks in Advance,
    Manjinder Singh

    One solution is to dynamically set the base href
    String s = "test.txt"; // "dummy" file in current directory
    File f = new File(s);
    s = f.getAbsolutePath();
    s = "file:\\"+s;
    p("<BASE HREF='" + s + "'>");

  • VS 2013 - SQL Server Projects - Can I Change defaults for SQL Servers to use and the paths to DB-files?

    Hi all,
    when a create a SQL Server Project using "File > New ...", I find the following settings defaulted:
    SQL Server is (local)\Version12.0 and
    DefaultDataPath, DefaultFileprefix and the DefaultFilename(s) for MDFs and LDFs point to the Project directory.
    Initial settings of file size and increments are also not settable but defaulted.
    Because my projects have to verify performance by testing with large volume of data, we have to use a different SQL Server with files stored on that Server. The Project settings have a button to changes DB properties, but these are not part of that
    dialog.
    So I spent some fruitless hours in vain to find a way to change the project's connection to my development SQL Servers.
    How to cope with that?
    Thanks in advance.
    Regards Uwe

    Hi Caillen,
    thanks for Your response. I have to apologize for being a little late with my answer. I'll try to clarify my case more precisely:
    This is surely a topic related to VS2013 handling new "SQL Server Database Projects". When one clicks "OK" the following steps are executed by VS2013 (surely controlled by standard templates or the like):
    VS2013 creates the new project in a selectable directory and uses the projectname as a subdirectory whre the directory elements (*.sqlproj, bin\, obj\) where  later all the *.sql are placed, too. This is normal and expected.
    VS2013 creates a new database with its DB-files
    and attaches it to "(localdb)\ProjectsV12". The name of the database is the name of the project. The path to the DB-files (*.mdf and ldf) and their sizes are also defaulted to small values. The DB-server and the
    path to the DB-files is taken from the registry (!) HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\SSDT\LocalDbDatabaseFilePaths. I don't know when and by what tools these values are set.
    The path to DB-Files is typically also the path to the projects. The (local)-server places all system database files in the User\<user-ID>\Appdata\.. tree. Which is OK for small databases. The templates extracts some data from the DB-file path and
    places it in the deployment SQLs to populate the SQLCMD variables DefaultDataPath, DefaultFileprefix and the DefaultFilename(s) which are generated when pressing "Executed" or "Debug" the project.
    My problem is that we have to test database performance with larger volumes of data (e.g. two million rows and more). These cannot be stored in the User-path but must be handled by some kind of professional DB-Manager on various storage devices. When everything
    is tested, the publishing function of VS2013 will extract the structure and you are done incl. all the performance taming things.
    The dialog from the project properties can change to a different Server, but that server does not know your project database. The server and the DB-Files should be specified by the developer before VS2013 creates the database.
    So  the right forum would be a forum, where people developing SQL Server solutions with VS2013 are reading the questions.
    Thanks again for your patience.
    Regards Uwe

  • Use Relative Path for Photoshop Action?

    I have a Photoshop Action that is programmed to open an existing file located in a specific directory.  The path to this directory is an absolute path, i.e.:
    C:\Program Files\Photoshop Actions\filename.jpg
    As long as the Action can find the file in the specified absolute path, everything works fine.
    My problem is that if someone tries to run this Action on a different computer (like a Mac), the path specified in the action does not exist and the Action will not work.
    The simple solution to this would be to make the action open the file located at a relative path.  This way no matter what computer the action is run on, it will always be able to find the file.
    Unfortunately, I don't think Photoshop Actions allow relative paths.  Does anyone know if using a relative path in an action is possible?
    Failing this, how would I use a Photoshop Script to somehow direct the Action to find the correct location of the file?  Or is there a better solution?

    The idea that I use in the xtools installer and else where is this:
    1) Convert the action file to XML.
    2) Package the XML file and the apps/ActionFileFromXML script with your stuff.
    3) An installer script will do a 'replace' (or whatever) on the XML file so that the paths are converted to whatever is needed.
    4) The new XML is saved and then converted to a .atn file which is then loaded.
    There is an xtools forum at ps-scripts.com that may have some info in addition to the PDF file that comes with the package.
    -X

  • XQuery import module relative path

    I'd like to use library modules in queries, with the modules stored in one or more configurable places. If I put them in files, and provide the full path to the file like so:
    import module namespace pi = 'http://ceridwen.us/2006/mymodule' at 'file:///path/to/module/file'
    It works fine so long as the path given is absolute. I've tried several variations on relative paths, including using 'declare base-uri' (which didn't seem to do anything) and XmlQueryContext::setBaseURI (which didn't help find the module file and caused the context to not be able to find the container). I've also tried giving paths relative to pwd and to the environment home. No luck.
    It would be even cooler if I could store the modules in a bdb database... but that would require adding a resolver somewhere. Is there a way to use an XmlResolver for this?
    Regards,
    John Ralls

    John,
    documentation: Well, if it's right then I'm reading it wrong. I guess that shouldn't be a surprise.
    base-uri: OIC.
    XmlResolver: Hmm. I added this:
    class Resolver : public DbXml::XmlResolver {
    public:
         Resolver() : DbXml::XmlResolver() {}
         virtual ~Resolver() {}
         DbXml::XmlInputStream* resolveEntity(DbXml::XmlTransaction* txn,
                             DbXml::XmlManager& mgr,
                             const std::string& systemID,
                             const std::string& publicID) {
         std::cout << "Resolver::resolveEntity: Got systemID " << systemID
              << ", publicID " << publicID << std::endl;
         return NULL;
    to my header and
    Resolver* rslv = new Resolver();
    this->registerResolver(*rslv);
    to the constructor of my DbXml::XmlManager-derived manager class.
    The resolveEntity() function doesn't output. What's wrong?
    (FWIW, the signature of resolveEntity in the documentation and that in the header(XmlResolver.hpp) differ: The latter doesn't have the std::string& result parameter. I tried both ways, and neither produced the output message.
    resolveModule: Yes, I think that that would be clearer.
    Regards,
    John Ralls

  • CFINCLUDE and relative path

    I have a website which has error catching in it and from time
    to time I have this error come through when using cfinclude.
    Could not find the included template
    project56/images1/page1.html. Note: If you wish to use an absolute
    template path (e.g. TEMPLATE="/mypath/index.cfm") with CFINCLUDE
    then you must create a mapping for the path using the ColdFusion
    Administrator. Using relative paths (e.g. TEMPLATE="index.cfm" or
    TEMPLATE="../index.cfm") does not require the creation of any
    special mappings. It is therefore recommended that you use relative
    paths with CFINCLUDE whenever possible.
    Why would this error occur for a few visiters and not for all
    when browsing my website?
    If I have to put some sort of mapping into CF Administrator
    what should I put as a mapping and why should this help?
    Thanks in advance for your help.
    Simon.

    The only thing I can think of is are you sure the page the
    'affected' users are clicking from are in a parent folder of the
    'project56' folder? The error occurs when the CFINCLUDE is looking
    in the wrong folder or when you try to include URL variables in the
    include statement.
    if you INCLUDE project56/images1/page1.html it will work, but
    if you INCLUDE project56/images1/page1.html?user=123 then you get
    an error because the INCLUDE looks for the actual text of what's
    between the quotation marks...it will not pass variables.
    I'd check the folder structure on where they are clicking
    from. In your error page, just have the referring page
    output.

  • LSMW by BI  : Unable to specify file in step 7; logical Path not assigned

    Hi,
    I'm trying to uplaod HR DATA using object 0555 and method 0000 for Program RPDUSTD00 using LSMW Batch Input Method.
    In step 7 when i specify file which tab delimited text file at front end pc(at my pc) let say  c:\test.txt and save I got error message 'Logical path not assigned'.
    Please suggest what I'm missing and what i need to do to get it correct.
    Thanks,
    Anshuman.

    Hi,
    There are other files specified in the screen for imported and converted data. These files must be accessible on SAP application server. If the logical file names are not created use physical ones lik /tmp/blabla.lsmw.read etc.
    Make sure you use different files for different objects.
    Kind regards
    Michael

  • 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();

  • Get absolut path of a file

    when I write to a file in the actuel directory,
    e.g fw = new FileWriter("file.txt");
    how I can get the absolute path of this file? (e.g. C:\dir\file.txt)
    thanks stn

    Captain Obvious says ..... File.getAbsolutePath();
    Thank you, Captain Obvious.

  • What is the absolute path of my file?

    Suppose my file is at the location
    C:\oc4j\j2ee\home\applications\r1\r1\WEB-INF\lib\us-english-v2-whole.dict
    what is the absolute path of this file.

    Congrats on 20k warner.
    Of course, if you're going to try to use that path in a String literal, you'll have to escape the backslashes
    String absPath = "C:\\blah...";In Java, most File I/O classes are smart enough to translate a path into one that works with your platform. So when using paths in say a File object, you can just use forward-slashes to be consistent and not have to escape them.

  • Getting absolute path of a file running in remote machine

    Hi,
    I want to get the absolute path of a file that will be created in the remote server. Inside a directory XYZ in remote machine, the file will be created and the remote machine's address is xxx.xx.x.x. I have used the following snippet
    File f=new File(Filename);
    f.getAbsolutePath();
    Now, in the output am getting the absolute path of the file as d:/XYZ/Filename. Is there any way to get the output as xxx.xx.x.x/XYZ/FileName ? Can someone please suggest why the server details are not fetched and instead the directory name is fetched.
    I am running the program to get absolute path of a file in my remote machine. and for accessing that remote file from my machine, I use xxx.xx.x.x/XYZ/FileName.
    Thanks in advance.

    I'm going to take it a step further and guess at what the OP is going to say next.
    On host w.x.y.z there's a file /a/b/share/some_dir/file.txt.
    Host w.x.y.z is sharing the /a/b/share/ directory as SHARE.
    Client mounts \\w.x.y.z\SHARE as D:, so that he sees D:/some_dir/file.txt.
    OP now wants to know not just that D:/some_dir/file.txt is \\w.x.y.z\SHARE/some_dir/file.txt, but also wants to know that on w.x.y.z, SHARE corresponds to /a/b/share.
    @OP: If that's what you want, forget it. Part of the premise of file common drive/directory sharing protocols is that the client does not know or care and does not need to know or care what the absolute path is on the serving host. It's none of his business.

  • Function that finds the absolute path of a file

    Hi,
    I'm creating an application using the SDL framework.
    The following code gives me the absolute path for the file "caisse.jpg", which is located in my application bundle. Then, I can use the value of "cstrURL" to load the image with IMG_Load(cstrURL);
    #import <CoreFoundation/CoreFoundation.h>
    int main(int argc, char *argv[])
    CFURLRef url = CFBundleCopyResourceURL( CFBundleGetMainBundle(),
    CFSTR("caisse"),
    CFSTR("jpg"), //extension du fichier
    NULL );
    const char* cstrURL = CFStringGetCStringPtr(
    CFURLCopyFileSystemPath(url,kCFURLPOSIXPathStyle),
    CFStringGetSystemEncoding()
    printf("URL: %s", cstrURL);
    return EXIT_SUCCESS;
    But I have many files to load for my application. I tried to create a function that would take as parameter informations about the image, and then automatically find the absolute path of this image.
    ( void imgPath(char name[], char ext[], char destination[] ---> name = "image", ext = "jpg", destination is a variable in which the function puts the absolute path of the file)
    How can I do that? What bugs me is the use of the CFSTR macro in the code I have...
    Thank you very much
    FRANKY

    The CFSTR macro can only use a constant string as parameter, not a variable one.
    You can use instead CFStringCreateWithCString if the parameter is a C String (char *).
    Additionaly, I think the input parameters of your imgPath function must be of char* type, not char. And the output parameter char** (but it would be easier to know with the function source code).

  • Getting absolute path of a file in a webapp without using servlet/JSP

    Hi all,
    I need a small clarification. Is it possible to reterive the absolute path of a file present in a tomcat web application without using Servlet/JSP. I have a normal java class which uses this file to read the configuration parameters. I like to know whether I need to create a seperate servlet which will read the parameters from web.xml.

    Hi all,
    I need a small clarification. Is it possible to
    reterive the absolute path of a file present in a
    tomcat web application without using Servlet/JSP. What if the file is in a WAR? What do you do then?
    I
    have a normal java class which uses this file to
    read the configuration parameters. There are other, better ways to do this.
    I like to know
    whether I need to create a seperate servlet which
    will read the parameters from web.xml.What do you really want it for? You shouldn't need an absolute path. Use the class loader to get an InputStream.
    %

  • X79A-GD65 (8D) MSIHQ error 654 Specified path name or file name is invalid.

    Hello,
    First, excuse my poor english...
    I would like to flash the 7760 v1.8 bios of my motherboard to install windows 8.1 on a crucial M500 480Go (yet, installing W8.1 after connect M500 on SATA1 6Go next to my M4 SSD with W7, causes errors during installation and I guess it is because i think the SSD is not correctly recognized by the bios and Windows 8.1 requires bios and ME updates.)
    I download the last bios on MSI site (http://us.msi.com/product/mb/X79AGD65_8D.html#/?div=BIOS) and install MSIHQ Tool 1.25g software to make an USB stick for flashing as describe here : https://forum-en.msi.com/index.php?topic=116721.0
    But when i point on the archive (3.1. Method 1: Processing a BIOS Archive Directly (ZIP/RAR)), MSIHQ can not open the archive and tell me: ERROR 654 Specified path name or file name is invalid.
    Yet when I use the same method to flash my bios from 1.6 to 1.8, it had gone well ... What to do?  Should I use the method described on the download page: http://fr.msi.com/files/pdf/Bios_update_SOPAll.pdf ?
    Thank you and good day.

    No, no...  I know what a dual boot if it is what you say, I did it for years. I also made two differents drives with two separate systems boot : a Hdd with xp and boot.ini , and another with windows 7 and mbr. After installing the first OS first on a disc, you disconnect this HDD and connecting the second to receive the second OS. There is no dual boot because I did not boot on the same partition then let me choose between 2 OS placed on two differents drives or two partitions, but I boot well on two differents disks , each with their own boot files this just saves me the dual boot which I find too heavy. On a Gigabyte X48T -DQ6 with the F12 key , you choose what HDD boot . Same I think with the F11 key X79A - gd65 : "Press DEL key to enter Setup Menu , F11 to enter Boot Menu" and then you choose between booting on either disc. In the case cited above , it is then that we arrive on the mbr of windows 7 on a disc or boot.ini windows xp on the other. So you do not answer my question, it seems to me :-) I wonder if I'm clear, there ...;-)
    thanks very much...

  • The specified file or folder name is too long,the url path for all files and folders

    The specified file or folder name is too long,the url path for all files and folders must be 260 character or less
    can we increase this limit?
    MCTS,ITIL

    Hi,
    As I understand, you want to increase the length of URL path in SharePoint 2010.
    Per my knowledge, this limit cannot be increased. SharePoint limits URL length because all relative URL links are stored in the clear forms on the SharePoint content DB and often this links are used as primary keys to link one table with another. Fields
    which are used to store these links (for instance tp_DirName from the AllUserData table) allow storing only 256 characters.
    There are several ways that you can resolve or mitigate URL length problems in the SharePoint Server 2010 environment. The following list provides suggestions:
    1. Upgrade all the end-user browsers to Internet Explorer 8, which has a longer URL length limit.
    2. Use shorter names for sites, folders, and documents and control the depth of the site and folder structures to reduce the lengths of URLs.
    3. If possible or allowed, use ASCII names for sites, folders, and documents. This will avoid situations where the URL will be lengthened by being encoded.
    4. To reduce the risk that the SharePoint Server 2010 end-users will encounter problems because of URL length limitations, we recommend that you apply the following effective limits in the deployment:
    256 Unicode (UTF-16) Code units - the effective file path length limitation, including a domain/server name
    128 Unicode (UTF-16) Code units - the path component length limitation
    More reference:
    http://technet.microsoft.com/en-us/library/ff919564(v=office.14).aspx
    http://sharepointknowledgebase.blogspot.in/2013/04/url-path-length-restrictions-in.html#.VKJN53BJA
    Best regards,
    Sara Fan

Maybe you are looking for

  • Installed new hard drive and ram but freezes on apple logo

    i have a mid 2010 macbook pro and last night i opened it up and installed a 750GB hard drive and 8gb of ram. now my computer doesn't want to boot up, even with the install DVD (original one) i have done the PRAM thing and even went back to my old har

  • Display acting up - desktop shifting, everything is blurry

    my display is acting up I just rebooted my 15" mbp (2ghz intel core duo, 1.6 gb ram) and suddenly large areas on screen (but not everything) is slightly blurry. I am running osx 10.4.10 at 1440x900px resolution. I already rebooted and the problem, wh

  • Prevent dragging a graph in one direction

    I'd like to prevent a user from dragging a graph around in a single direction.  For example, I want to limit it so that the user cannot drag a graph beyond the end of the current data set.  Currently, if the user gets to the end of a data set, they c

  • Performance issue:Show id and Description for same dimension member

    Hi, I am connecting a cube to another reporting system and i need to show the id of member resulting of a query.My first thought was to use this kind of code (bellow) however when i do the same thing with many dimension (many cross join ),it slow dow

  • Additional  Cost for Item cost

    Hi all! My production ordr have additional cost: labor, electric. I don't define standard cost for them. I want to fill in production order these costs equal x% of Itemcost. Can i do that. Or if you have other ideas to use additional cost, you can he