File curFile = new File(".");
URI uri = curFile.toURI();

解决方案 »

  1.   

    不是要URI,而是要path
    我试过了
    File f=new File(".");
    String fPath=f.getPath();但是结果fPath="."
      

  2.   

    For xample:
       JButten bt = new JButton(new ImageIcon(getClass().getResource("images/chat.gif")));
      

  3.   

    上例:表示构造一个带图标的按钮。图标从当前主类所在的目录下的images目录中得到!