小编sti*_*mpy的帖子

Java文件IO和"访问被拒绝"错误

我一直在撕扯头发,因此我寻求一些帮助.

我有一个代码循环执行以下操作

//imports ommitted
public void afterPropertiesSet() throws Exception{

  //building of URL list ommitted  
  // urlMap is a HashMap <String,String> created and populated just prior   

    for ( Object urlVar : urlMap.keySet() ){
    String myURLvar = urlMap.get(urlVar.toString);
    System.out.println ("URL is "+myURLvar );
    BufferedImage imageVar = ImageIO.read(myURLvar);//URL confirmed to be valid even for executions that fail
    String fileName2Save = "filepath"// a valid file path
    System.out.println ("Target path is "+fileName2Save );
    File file2Save = new File (fileName2Save);
    fileName2Save.SetWriteable(true);//set these just to be sure …
Run Code Online (Sandbox Code Playgroud)

java file-io windows-7

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

file-io ×1

java ×1

windows-7 ×1