Can not read file from URL

I have this code for loadbitmap() function:
String s = getCodeBase()+sdir+sfile;
System.out.println("codeBase is=" + s);
URL url = new URL(s);
InputStream fs = url.openStream();
BufferedInputStream bs = new BufferedInputStream(fs);
And the file is a .bmp file, so I go on decoding this etc. It works fine within VisualCafe.
When I created a virtual directory in IIS and run this applet from
http://localhost/ImageApplet/ImageApplet.html address:
I get in 1.3.1 Plug-in this error:
codeBase is=http://localhost/ImageApplet/duke/some1.BMP
Caught exception in loadbitmap!java.io.FileNotFoundException: http://localhost/ImageApplet/duke/some1.BMP
If a type this as address in browser, it shows the image.
Could any one tell me what I am doing wrong here?

You can try this, even though it is not supposed to be different from your original code:
URL url = new URL(getCodeBase(), sdir+sfile);
System.out.println("getting image from " + url);
InputStream fs = url.openStream();
BufferedInputStream bs = new BufferedInputStream(fs);
I could understand a SecurityException but a FileNotFoundException... A FileNotFoundException... You are reading from a stream originating from a URL, not a file!!!
Which line causes the exception?

Similar Messages

  • Can not read data from URL!

    Hello,
    I want to read data from URL (http://84.100.130.82:8000/;stream.nsv). But can not do it. Because when try to call function openDataInputStream() shows this error: java.io.IOException: response does not start with HTTP it starts with: ICY. How I can fix this bug?
    HttpConnection c = null;
    InputStream is = null;
    OutputStream os = null;
    StringBuffer b = new StringBuffer();
    String           response,
    responseLitle;
    c = (HttpConnection)Connector.open(“http://84.100.130.82:8000/;stream.nsv”);
    os = c.openOutputStream();
    os.flush();
    is = c.openDataInputStream();     // ERROR CODE HERE
    int ch;
    // receive output
    while ((ch = is.read()) != -1)
    b.append((char) ch);
    response = b.toString();Regards, Ramunas

    Hi, I�m trying to do the same as above, get MP3 from a Shoutcast server.
    I got the same fault ("response does not start with HTTP it starts with: ICY") when I tried to open an HttpConnection as bellow:
    ============================================
    HttpConnection conn = (HttpConnection) Connector.open("http://64.236.34.196/stream/1074");
    Then I tried to open a socket connection as bellow:
    ======================================
    SocketConnection conn = (SocketConnection) Connector.open("socket://64.236.34.196:80");
    String get = "GET /stream/1074 HTTP/1.1";
    DataOutputStream os = conn.openDataOutputStream();
    os.writeUTF(get);
    InputStream is = conn.openInputStream();
    But then I got the following error:
    =========================
    java.lang.SecurityException: Target port denied to untrusted applications
    Could someone help me to find out what is going on?
    Thanks a lot!

  • Can not delete files from Adobe reader

    can not delete files from adobe reader.

    Can you let us know a little more about what you are trying to do? Adobe Reader opens pdf files but does not store them so, there's nothing to delete.

  • I just stared having problems with importing files from nikon D810 into LR 5.7 it pop a window saying it can not read files on working on a imac 27" running yosemite on my mac pro after a few times it finally was able to read files and import them into LR

    I just stared having problems with importing files from nikon D810 into LR 5.7 it pop a window saying it can not read files on working on a imac 27" running yosemite on my mac pro after a few times it finally was able to read files and import them into LR I never had this problem before was there some kind of update that could of cause this?

  • When I was talking on phone, suddenly the phone was switched off. i tried to switch it on but it gave the message....connect to itunes for set up.  when I connected it to itunes...it gave the message, itunes can not read data from this iphone, restore it

    when I was talking on phone, suddenly the phone was switched off.
    i tried to switch it on but it gave the message....connect to itunes for set up.
    when I connected it to itunes...it gave the message, itunes can not read data from this iphone, restore it to factory settings. It also said while restoring ypu will lose all media data but you can restore the contacts.
    I restored the factory settings....the phone was on recovery mode...it was verified by itunes and all that..but in the end it again said that iphone has some problem and can not function right now.
    after that when ever i connect it with itunes, it gives the message, it can not activate the iphone further, try again later or contact customer service.
    What to do now?????? Customer service people say..it is hardware problem

    If it's a hardware problem, then the phone will need to be replaced.
    There is no magic that can fix a hardware problem.

  • PI sender communication channel not reading files from NFS directory

    Hello,
    I have a sender communication channel configured to read file from NFS directory which is on ECC server. A program in ECC generates the file and puts it on the ECC server in the output directory. PI sender communication channel is supposed to pickup this file and process it. If I give the NFS path as the source directory, I am getting error: Configured source directory '//Server/DIR/OUT' does not exist. I tried putting '
    Server\DIR\OUT' too but same error. Do I have to add the NFS path of ECC into PI as logical path?
    Any suggestions?
    Thanks,
    Sangita

    Hello Sangita,
    Your ECC server is an external system, therefore you need to activate FTP service in that system and use the transport protocol FTP:
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
    You can use NFS protocol when you have a local directory in XI server.
    Best Regards,
    .Luis Bernal.

  • Can not change files from "Read Only" In Windows 8.1

    I am the only Administrator on my computer, there are no other accounts. Some how all my files now have the read only attribute and I can not change it. It gives me the option to change it and I do and it looks like it got rid of it; but as soon as I close
    out of the properties window and go back into the read only attribute is still there.
    The read only attribute doesn't even act like itself because I can still edit the files that are in the selected read only folder. But it doesn't let me change the folder group options.
    None but one of these folders are customized so it is not a problem that can be resolved by the other threads I have read.
    Even new files I create have the read only attribute, please help, this is really annoying.

    Hi,
    For this problem, please refer to the KB below to repair the problem for test firstly, If no use, please feel free let us know.
    You cannot view or change the Read-only or the System attributes of folders in Windows Server 2003, in Windows XP, in Windows Vista or in Windows 7:
    http://support.microsoft.com/?kbid=326549
    Note: This article also applys to Windows 8.
    Roger Lu
    TechNet Community Support

  • Read file from URL and save to FTP

    Hi,
    I have worked in java few years back, now I am out of touch. My friend asked me to create an applet program for him which he can use to download a file from remote location to his ftp server.
    For e.g.
    File
    http://www.demo.com/filename.avi
    Saved to
    ftp://username:password@ftpsite_address/foldername
    I was searching for the classes which I can use to achieve this functionality.
    To save to FTP
    URL url = new URL("ftp://username:[email protected]/folder/filename");
    URLConnection urlconnection = url.openConnection();
    long l = urlconnection.getContentLength();
    OutputStream outputstream = null;
    outputstream = urlconnection.getOutputStream();Using the above code I can get the outputstream to which I can write.
    I am now stuck here, have some doubts.
    What all classes should I use to read a file like
    http://www.demo.com/filename.avi
    I know I can use URL to open connection to URLS and then streams to read the url.
    I am interested in knowing the class which I should use to read any type of file. File can be zip/avi/rar or anything else.
    What all method of the class should I use to read the file which will support all type of files.
    Which classes should I use to write the files. The files are going to be huge in terms of size.
    I have searched everywhere but every place different classes are used.
    Any help is appreciated.

    Ok now I have started coding but facing a problem.
    [PHP]try {
         URL url = new URL("http://url_to_file/test.txt");
         URLConnection urlconnection = url.openConnection();
         long l = urlconnection.getContentLength();
         fTextArea.append("Content Length = " + l);
         BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
         String line;
         while ((line = in.readLine()) != null)
              fTextArea.append("\n"+line);
         in.close();
    } catch (Exception e) {
    fTextArea.append(e);
    return;
    [PHP]
    When I run this code locally it works fine but when run in browser it shows security exception
    java.security.AccessControlException: access denied (java.net.SocketPermission site:80 connect,resolve)
    What should I do to resolve this error. Sorry for being such a noob but do not have much info about this.

  • Cameraw raw says it can't read files from T2i from 6.1 but ...

    I had installed CS5 as trial and installed Camera Raw 6.1 - everything worked fine.
    Then I bought and registered CS5, uninstalled CS4 and suddenly LR 2.7 didn't find CS5 as an external editor - even after a reboot and there was no apparent way to make it do that.
    So, I uninstalled CS5 and reinstalled and it showed up in LR 2.7.
    Now, however, CS5 does not recognize my Canon T2i files as it says the Camera Raw version does not support the file format. It did before i bought and registered in the extended version but when i put the new serial number in and it went from extended the regular version, it stopped being able to read the files.
    My version in about and plugins is 6.0.0.205 in CS5 now
    I have downloaded and attempted to install the camera raw 6.1 updater several times - it says some updates failed to install- update is not applicable.
    Tech support says that is the newest version.
    In my trial version, the updater installed, i could read T2i files but now it won't install and i can't read my T2i files.
    I can go through Lightroom which seems to read them OK - I even resinstalled LR 2.7
    What can I do? I want to be able to read some files directly in PS CS5 from the T2i files.
    Thanks
    Greg Summers

    You should ask in the  Camera Raw forum.

  • IMovie 10 Can NOT Import Files from Older iMovie Projects

    I have older iMovie projects on an external drive and want import/upgrade them to iMovie 10.
    After choosing the old projects, iMovie 10 examines the old projects for a while and then gave me a list of files that it cannot import. The files I remember on the very long list are .plist and iMovie project files.
    Should I be concerned?  In other words, is iMovie 10 now using a new file format that makes these files superfluous?  Will iMovie going to incorporate their information in the new architecture, or will some functionality be missing from the imported projects?
    I'm running iMovie 10.0.2 on OSX 10.9.2 on a 27" iMac.
    Thank you for your time and attention.

    I'm going through my old iMovie projects and importing them one-at-a-time into iMove '11 (ver 9.0.9, build 1795)
    I don't know the version of the projects that I'm importing but they have this directory structure and have file creation dates in 2007:
      Unfortunately, when I import them, I lose most of the editiing that from the old project:
    In case you can't read the area in red, it says:
    Notes about the imported project:
    All transitions wll be replaced by Cross Dissolves.
    Titles and music tracks will not be imported.
    Video effects will not be imported.
    Isn't there a way to import older iMovie projects in their entirety and completely intact?
    Thank you for your time and attention.
    - nello

  • I can not share file from Jabber for Iphone and Android

    Hi guys.
    I have:
    CUCM9.1/Publisher y Subscriber
    System version: 9.1.1.41900-1
    Presence/Publisher
    System version: 9.1.1.41900-1
    Expressway x8.1.1
    Cisco Cisco Expressway-E
    Expressway x8.1.1
    Cisco Expressway-C
    Jabber for Android and Iphone 10.6
    I do not have "file transfer"  and my Iphone an Android.
    I don not have "share desktop" from internet on my windows jabber.
    The calls and chat is working fine, but when I wante send a file, the option on my iphone is disable.
    Why?

    Hi dennisalpizar07,
     check this:
    Jabber for Android officially supports receive BFCP video sharing on TAB devices (normally used for Android Tablets without native calling capability).
    The Jabber for Android 10.6 release enters a beta trial on receiving BFCP video sharing on BOT devices (normally used for Android smartphones and phablets)
     page 2 of the Cisco Jabber for Android 10.6.x Release Notes.
    Hope this helps.

  • Can't read files from Sandisk USB

    Hi,
    My MacBook Pro recognizes my USB drive, but none of the files show when I open up the USB. It says 17.47 GB available out of 32 GB, but 0 files.
    My sister recently borrowed the flash drive to transfer files from her PC lap top, did she format the USB so that none of the files I had are available any longer? If so, I would think that it would show the USB with full capacity available.
    I ran disk utility and tried to repair the drive. It shows that there are 3,549 files on the USB, but I don't see any of them.
    Thanks,
    Gordon

    Hello,
    I take it you have the Sandisk Cruzer 32GB right ?
    I have had the same issue, there is possiblely two reasons why this is happening, the second reason is what happened to me : ( .
    1. You sister may have partitioned part of the drive while on the windows machine to NAS format not readable on the mac side of things.
    2. Its seems to be a common issue with Sandisk Cruzer 32GB Devices, they suddenly become unreadable by the Mac after connecting them to a windows computer,
    The drive is initially designed for use with windows machines and comes preloaded with U3 backup software ( which is the cause of all the problems )
    you cannot uninstall the U3 software from a mac even by reformatting the device via disk utility
    it can only be uninstalled via a Windows PC, which is a pain !!!!
    if the second issue sounds like you trouble let me know and i'll explain how to get it working
    thanks
    Yaddle

  • Can't read chinese,can't read files from memory ca...

    is there anyone in here who can HELP me..! i two years ago i bought nokia N80 while i was in Finland.with the model :N80-1 code : 0529381 type: RM-92.yesterday,i was trying to update it from V 4.0623.0.42 of 20.09.2006 to V 5.0719.0.2 0f 24-05-2007..it works great,with new features..but am facing three problems now
    1.i cant read chinese characters (they all looks like boxes)
    2.i cant read my memory card(mini sd 2G)
    3.i want to watch a movie through it,i mean i can copy and paste into my SD card,but i dont know which software should i use so that i can be able to watch through my mobile.
    anyone to help
    thank you guys

    I can't read Chinese mails from my pals in China.
    They show like this:
    I tried to change the encoding, but nothing changed.
    What's wrong with it? how can i read this mail?
    For one of these messages, go to View > Message > Long Headers and tell us what the Content-Type header says. That is the encoding you need to choose in Message > Text Encoding.
    Everytime I write in Chinese and
    Japanese, I have to change to the encoding of the
    right language manually, otherwise my friends won't
    be able to read them. How can Mail recognize what
    language I am writing in and change to the right
    encoding automatically?
    The encodings being used by Mail are already "right" by international standards, but the software being used by your friends apparently requires something else. You can fix it for one of the languages with the info in this note, but the other you would still have to do manually:
    http://discussions.apple.com/thread.jspa?threadID=121808&tstart=60

  • How can I read file from filepath and Insert in to SQL Server ?

    Hi,
    I have table called "table1" and has data like this ..
    id
    Folder
    FileName
    1
       f:\cfs\O\
    ENDTINS5090.tif

    D:\Grant\
    CLMDOC.doc
    3
     f:\cfs\Team\
    CORRES_3526.msg
    4
      f:\cfs\S\
    OTH_001.PDF
    I have another table called "table2" with content column is image datatype.
    Id
    FileName
    Content
    1
    FileName
    2
    ENDTINS5090.tif
    3
    CLMDOC.doc
    4
    CORRES_3526.msg
    5
    OTH_001.PDF
    I would like to insert in to content column in the table2 by reading the file from filepath( table1).
    Is there any simple way or SSIS  able to do it ?
    Please help me on this.
    Thank you.

    http://dimantdatabasesolutions.blogspot.co.il/2009/05/how-to-uploadmodify-more-than-one-blob.html
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • After installing version 3.6.12, i can not download files from websites

    After installing the newest version of Firefox for my Powerbook G4, running OS X 10.4.11, I am having great difficulty getting any files to download. Any file that you click on and should download on its own will not. I can not right click and save as all of the time. Some of the sites I work on require you to click, and then print. This does not work. Please advise. Thank you.

    How do you go about downloading an earlier version of Flash player? cy204

Maybe you are looking for