在文件中,但读图片的程序是个Applet。

解决方案 »

  1.   

    为什么不用serverlet。
    applet也可以:
    //Image m_oImage=getImage(getCodeBase(),"TestVC.GIF");File f = new File("e:\\T14.gif");
    FileInputStream fin = new FileInputStream(f);
    byte[] ib = new byte[(int)f.length()];
    fin.read(ib);
    fin.close();
      

  2.   

    读文件不能用绝对路径吧!因为是在applet中读服务器的文件,怎么办?
      

  3.   

    public URL getDocumentBase()conn = URLconnection(url);in = conn.getInputStream();
    byte [] buff = new byte[2000];
    in.read(buff);
      

  4.   

    URL url = getDocumentBase();conn = URLConnection(url);in = conn.getInputStream();byte[] buff = new byte(20000);in.read(buff);
      

  5.   

    同意楼上的.
    applet是可以取来源服务器,不受限制.
    url还要能取相对路径,读数据最好用buffer,先存为ByteArrayInputStream,
    再转为byte[]
      

  6.   

    能具体些吗,比如我要读d:\temp\images\1.gif文件?一定给分!
      

  7.   

    我对JAVA是第一次听说
    他大概是干什么用的
      

  8.   

    由URL url = getDocumentBase();取得的url如何与具体路径文件关联,我不太
    清楚.
    一种替代方法是对被监听的url,在其doPost方法中,分析request,取得需要的
    文件,读文件,向response输出文件流.在客户端取输入流即可.
      

  9.   

    getDocumentBase();是取得你applet 嵌入网页的URL,所以你只要把你的图像文件放在'/image'下,并在把'/image/filename'加在后面就可以了。