URL of a local file

Hi java experts.
I have a function which takes URL as a parameter. But the file I want it to supply is on local hard drive. my file path is e:\administrator\source\defualt.htm. how to represent this file as a url string.
Thank you.

Try "file://e|/administrator/source/defualt.htm".
If you just want the URL object and don't care about the actual string you can use new File(path).toURL().

Similar Messages

  • How to treat URL as a local file

    Hi,
    I am working on an existing piece of code. The whole code has been designed in such a way that all the methods take file as the argument. for example getMiMeType(File F) ........However, now my function is to add streaming capabilities so that lets say i can run the file http://www.xyz.com/ix.mpg and use the existing methods instead of writing new ones, how can i do that. Help Appreciated.

    Fair enough, these are basically media files that will be read and then played. At the moment the application is stand alone so all the functions take arguments as files. Now however, if I want to add a file which is on lets say at some webserver, then i have got the problem. Because i cant find a way to treat the URL as a local file. However, the idea of extending the java.io.FIle is good but still too long.

  • URL for viewing local files

    I'd been using Browserlab successfully today, viewing local files from Dreamweaver CS5. I logged out and then returned later in the day and am now having problems as the Browserlab window is failing to  automatically load the local file's URL in the box at the top of Browserlab screen (the URL box just stays blank. Can I manually input the local address and if so can someone advise the general format. I assume something like http://localhost/.... Obviously I will need to input my own file names, but just need the root URL/general format for viewing local files.
    Thanks

    Hi flowersplash,
    Thank you for your interest in BrowserLab.  Please check to see if you have the BrowserLab web site open in another browser or browser tab.  You should only have one instance of BrowserLab open at a time.  You might also try restarting your browser (all instances) and Dreamweaver and if that doesn't work, the OS.
    BrowserLab currently only allows you to specify local or firewalled URLs from Dreamweaver.  Directly inputting a URL into the BrowserLab testing interface will test the page from the perspective of a person elsewhere on the Internet.  Open the site you want to test in Dreamweaver LiveView, select "Local" in the BrowserLab Panel in Dreamweaver and click the Preview button.
    Cheers,
    Josh

  • Download a PDF from an URL to a local file

    Hi all,
    we are trying to get a pdf file from the internet with FM HTTP_GET, and after that download to a local file with WS_DOWNLOAD.
    Our problem is that we do not know wich type of table to use in order to retrieve the RESPONSE_ENTITY_BODY from HTTP_GET.
    Sometimes the PDF have 4000 of length sometimes 1200.
    Could you please help us?
    Regards,
    Rubé

    hi
    you can have a look at RSHTTP* programs.thta is ,for cl_http_client demo program try RSHTTP01 and for http_get demo program try RSHTTP20.
    hope this helps
    regards
    Aakash Banga

  • Error opening URL-local files-mac

    I'm using a var and an Array code on an empty move clip. The code is set on an "Actions" layer. The code checks good. All files are on my desktop.
    When I test movie I get 'Error opening URL 'file:///Andrea/Users/user/Desktop/BosigerWk6/swfs/one.swf'
    I'm on Mac running CS3. Flash setting is set to "Access local files only" I searched hours for a solution to this problem.
    Please help. Here's the code:
    //your swf list can be anything and any length. I named them one two three so you can easily test that it works
    var swfList:Array = new Array("one.swf", "two.swf", "three.swf", "four.swf", "five.swf", "six.swf", "seven.swf", "eight.swf", "nine.swf", "ten.swf", "eleven.swf", "twelve.swf", "thirteen.swf", "fourteen.swf", "fifteen.swf", "sixteen.swf", "seventeen.swf", "eighteen.swf", "nineteen.swf", "twenty.swf");
    var i:Number = 0;
    loadMovieNum(swfList[i], 1);
    //where next button has an instance name of 'nextBtn'
    nextBtn.onRelease = function(){
        i++;
        if(i > swfList.length - 1){
            i = 0;
        trace(swfList[i]);
    //your load funtion here like loadMovieNum(swfList[i], 1); or instance name.loadMovie(swfList[i]);
    //where previous button has an instance name of 'prevBtn'
    prevBtn.onRelease = function(){
        i--;
        if(i < 0 ){
            i = swfList.length - 1;
        trace(swfList[i]);
    //your load funtion here like loadMovieNum(swfList[i], 1); or instance name.loadMovie(swfList[i]);
    Thanks you so much,
    Andrea Bosiger

    I had a problem to test my movies locally in Flash Professional CS5, too. When I turned off the encryption on my Mac, the problem went away.

  • URL for local file?

    URL url= Room.class.getResource("images/door.jpg");This works.
    URL url= Room.class.getResource("file:/home/cs02rm0/folder/src/images/door.jpg");This doesn't work - java.lang.NullPointerException although if I put "file:/home/cs02rm0/folder/src/images/door.jpg" in konqueror the image pops up nicely. I also tried creating a File object and using file.toURL().toString() - but that just output the same string.
    Can anyone tell me why and how I can correct it, or suggest a workaround?
    Many thanks

    File file = ...;
    URL url = file.toURI().toURL();

  • Safari doesn't download files, it instead tries to open the url associated with the file.

    As stated in the title, when I try to download a file from the internet, clicking on the link associated to the file will not start a download, but instead opens a new tab in my browser showing the url of the associated file. If I then right-click and choose 'Download linked file as...' the file can be downloaded with no issues in most of the cases, at least as long as the website allows right-click downloads to happen.
    Does anybody know why this could be? I have tried resetting Safari, emptying the cache and, of course, updating my software. It is a midly annoying problem, but it doesn't happen when I use other web browsers in my iMac. Any help would be appreciated. I'm using Lion in a late 2009 iMac with, as I said, updated software.
    Thanks!

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up a guest account” (without the quotes) in the search box.
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem(s)?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault in Mac OS X 10.7 or later, then you can’t enable the Guest account. The Guest login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled under Mac OS X 10.7 or later, you can’t boot in safe mode.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.

  • How to copy a page webpage into a local file (for eg C:\\file.doc)

    Hello all,
    i wrote a programm code which can get my system information (date,tomcatversion,jdk version, server name and version and ...)
    if navigate to the url (on my localserver) htt://localhost/pp/version.jsp i would see all this in formation but how can i copy them into to a local file?
    i can create the file with: FileWriter fw = new FileWriter("C:\\file.doc");
    and copy this information line by line with:
    fw.write("Application server name and version:");
    fw.write(application.getServerInfo());
    fw.write("\n");
    But if i write fw.write(new java.util.Date()) // for the system date/time it doesn't work also fw.write(java.util.Date()) ) or fw.write(Date())
    or Date da = Date() and fw.write(da) no result...
    import are:
    <%@page import="java.io.*" %>
    <%@page import="java.util.*" %>
    please help....

    thanks !! what does this means ? It is possible or no yes yes i need i syntax or an example ... i'm new in java :)

  • How can I disable local file access security check?

    Windows 7
    Firefox 3.6.16
    I would like to disable the security check used for blocking access to local files.

    I don't know if this is completely correct, but...
    I have the NoScript extension installed. When I looked in about:config, I found an entry called:
    noscript.allowLocalLinks
    When I toggled this to "true," I was able to navigate via URLs to local and networked files.
    When I looked it up, I found out that you can set this switch using the NoScript UI (Options|Advanced|Trusted).

  • How Can I Get A Flash Movie to Access Local Files

    I have a customer that has created a Flash movie to run off a CD.  The movie is basically a set of menus with links to access local files in the same directory as the movie.  i.e. Main folder (to be root of CD) has the movie, a Documents folder with PDFs, a Movie folder with wmv and mov files, etc.
    The problem arrises when you click on a link to a file, a web browser is launched, and the browser tries to display the target file.  The movie was designed on a Windows system, and, mostly it works in a Windows environment, however, the links totally crap out on a Mac because the URLs are pc centric.
    He is a rookie flash programmer so I am trying to help him set up proper links to the files, so that the files will (hopefully) launch the proper local app and not a web browers.  i.e. if the link points to a PDF, the Adobe Reader is launched; if the link is to a mov file, then QuickTime is launched....
    Is there a way to do this?  All the tutorials I have found all seem to expect the flash movie to be running on a web server, and as such do not work when running the movie off a CD.
    Any help or suggestions would be grealy appreciated.
    A response ASAP would also be greatly appreciated as the customer needs to deliver 200 CDs of the project for a presentation tomorrow morning - I have to create the CDs...
    TIA

    Hi there,
    Maybe you would want to use swfObject, i've been using it for
    a long time now.
    http://blog.deconcept.com/swfobject/
    cheers

  • How to open a local file from javascript in a jsp-page

    Hi
    I have created an iview from a PAR file. In the par file I have a jsp-page with some javascript code. From the javascript coe I want to open a new window with an Excel file.
    I have tried window.open("c:
    test.xls", "test_window"), but it doesn't seem to work. I have created a small HTML page locally with the same command and there a new window opens with the Excel file.
    If I change the local file path with an URL it also works.
    Any idea how to open a local file ?
    Thanks
    /Jakob

    Jacob,
    I'm not 100% (but 99,9%) and it has to do with security ristrictions of the browser not allowing to have local workstation interation from the web. This is ofcourse very dangerous if the browser would allow it... So therfore it is blocked. What if somone would point to a file/executable that formats your drive so for that reason it is not allowed to have web interaction with a local file. Only with Java Applets this is possible but still with many limitations, and what I remember Google Gears and Adobe Air do have some limited web 2 local file interaction... So best and most simple solution you are left with is pointing to a url instead of a file on a c:\ drive.
    PS The reason why it works when you start the html from your local PC has todo with the fact that the browser detects that the html is not running in the web at that moment therefor allowing the access.
    Cheers,
    Benjamin Houttuin

  • How can i make hyperlink to local file for dowloading

    How can I make hyperlink to a local file for downloading it, it seams that only www links work in web Ui.
    Thanks

    If we assume that you have a LabVIEW application running on your cRIO that is exposing some data through web services, there are a couple of possibilities.
    You can create a web service call that returns the log data. In order for the browser to treat this as a file, you must set the correct content type in the http header. To do this you can't use the default form of data output. Instead you must create an "httpRequestID" input to your web service VI. With this you can call "Write Response.vi" to give the log data and "Set HTTP Header.vi" to specify the type (text/text probably works for a log). You can look at "examples\comm\webservices\address book\FindContacts.vi" to see an example of calling these 2 VIs. Once you create that web service entry point, you can set that as the URL of the hyperlink control and it should work.
    Another option is to have the cRIO application write to a log file that is under the root of the web server running on the machine. (This is the same place the xap for your Web UI Builder application is put.) This file could then be served up through the web server just like any other file.
    With either of these solutions there may be concerns about the browser caching results rather than requesting new content each time. There are additional values that can be set in the http headers with the first solution that can help with this, but I think there is still some variation between browsers.

  • Error - In generating URL for a Excel File in WebDynpro Project

    Hi,
    In my WebDynpro Application, i have a EXCEL file ("Test.xls") and it is kept in the below mentioned location.
    Project->src->mimes->Components-><my component>
    This is the code i have used to generate URL.
    IWDWebResource webRes = WDWebResource.getWebResource(wdComponentAPI.getDeployableObjectPart(), WDWebResourceType.XLS,     "Test.xls");
    String excelFileURL = webRes.getAbsoluteURL();          
    wdContext.currentContextElement().setExcelFileURL(excelFileURL);
    i have assigned the URL to context element which in turn is assigned to LinkToURL UI element.
    I always get this error "Invalid URL=/webdynpro/resources/local/RigsOnMove/Components/ndc.maintain_rigmove.MaintainRigMoveComp/Test.xls".
    Please let me know your solution(s) to the above mentioned issue/problem.
    Thanks
    Senthil

    Hi Senthil,
    your code seems to be correct! Probabily your file is test.xls (NOT Test.xls with the first letter in uppercase).
    Try to write:
    IWDWebResource webRes = WDWebResource.getWebResource(wdComponentAPI.getDeployableObjectPart(), WDWebResourceType.XLS,     "test.xls");
    Hope this help,
    Vito

  • BrowserLab won't work with local files in DW CS5

    Any issue report you make about BrowserLab on these forums should minimally contain the following information. If it doesn't, the first response you get from us will likely just ask for the missing info anyway
    Subject
    A descriptive summary of the issue.
    The body should contain:
    Problem Description
    A brief description of the bug or issue
    Steps to Recreate
    The steps we should follow to reproduce your issue. Minimally include all the following:
    Does the issue happen every time, is it sporadic, or did it only happen once.
    Are you testing on Mac or Windows?
    Are you using the main BrowserLab interface, testing via Dreamweaver integration (and if so, what version of DW), or using the BrowserLab for Firebug add-on?
    What is the URL you're testing against. If it's not public, let us know and let us know if you can send us the page source.
    Expected Results
    Based on the steps you described, what you thought should happen
    Actual Results
    What actually did happen
    Thanks everyone,
    Mark
    Using BrowserLab in DW 11.0 Build 4964, BrowserLab can't seem to work. Some not very intuitive places I have checked include making sure the signon credentials are in the CSLive window in DW.
    In preview local/browser, the following messages are disappointing me:
    Timed Out, Failed to Authenticate with Browserlab
    Session Expired, See Browser
    It is on a Mac, 10.6.7, using DW integrated testing. I can log into browserlab and put a public URL, but I don't think that's going to be much better for me than having VMWare and installing free browsers on Mac and Windows, and given the failures here that would be better for local file checks too. I write this because I wonder if I will be disappointed trying to get this to work and then find out I have to pay a yearly subscription to CSLive to be able to keep using it.
    This is on a private URL and I can send the page source, but I don't think its the page that is causing the issue.
    Expected results:
    Able to preview page in any browser of my choosing
    Actual results:
    Spent the last two hours navigating help, googling possible solutions, getting many errors trying to navigate the Adobe help and forums, continually signing in on each adobe page I open. Expecting to have to reauthenticate to post this message. (Updated extension manager as well).

    Hi,
    First, there is no charge currently for using CSLive and there won't be any charge for another year.
    Second, based on what you're saying about the behavior you're seeing with BrowserLab and the issues you had with continually having to sign onto the Adobe pages, it's a strong indication that you've got cookies disabled in your browser or that something on your machine is deleting/expiring the cookies we are trying to set. What browser/version are you using and what kinds of permissions have you got set for cookies in that browser? Can you check that and change your cookie permissions for Adobe.com at least?
    Let me know if that helps or not,
    Mark

  • When i drag and drop an image on my site. it gives the following error. "Unable to access local files due to browser security settings. To overcome this, follo"

    I am using the firefox version 17 and when i drag and drop an image on my website. It gives me the following error.
    Unable to access local files due to browser security settings. To overcome this, follow these steps: (1) Enter "about:config" in the URL field; (2) Right click and select New->Boolean; (3) Enter "signed.applets.codebase_principal_support" (without the quotes) as a new preference name; (4) Click OK and try loading the file again. Or go to the homepage for a link to the tutorial on how to do it.
    I have completed the above steps and it is still showing the same error message. Any help would be highly appreciated.
    Thanks.

    Thanks kumars ,
    I have a specific drag and drop area on our website. This works fine for all earlier releases of Firefox after these security settings
    "(1) Enter "about:config" in the URL field; (2) Right click and select New->Boolean; (3) Enter "signed.applets.codebase_principal_support" (without the quotes) as a new preference name; (4) Click OK and try loading the file again."
    Bust these settings not work for me in Firefox 17.
    Yes the drag and drop functionality is java script based and i am not using any script blocker addons.

Maybe you are looking for

  • Error while creating shipment cost

    Good morning, I'm trying the solve an issue when we create a shipment cost. I get the following error when trying to transfer the cost "No purchase order item was generated for shipment cost item" / "in case of evaluated receipt setlement, please ent

  • Finder does not display icon for word / excel in list view

    Hi, I got a new macbook air, with Yosemite pre installed. I copied over all my files (from my old macbook using a USB drive) and next I installed MS office for mac. For some reason Finder does not display the correct excel of word icon in list view (

  • Schedule for Java ME SDK 3.0 for Linux?

    Hi, thank you for Java ME, we are using it since many years with on Linux development platform. Currently we plan to use the Sensor API, which is missing in WTK2.5.2 for Linux. What are the current plans for Linux? thanks, Marcel

  • HT204088 Store reckons that I need to answer some security questions because I wanted to download an app on my new iPad

    I bought a new iPad and I am trying to buy  the first app and the store wants an extra security check with the two questions. I have answered the questions and I think my answers are right. But the store reckons it is incorrect. What do I do? I ticke

  • Have prompt default to the current month?

    One of my prompts displays a list of months; e.g., Jan, Feb, ... Dec. The user selects the month they want to report on. I need the prompt to default to the current month. Is this possible within Web Intelligence?