你先用IE看看
http://192.168.0.1/sp/t1.png
能不能访问到

解决方案 »

  1.   

    public class GetWidth {
        public static void main(String[] args) {
            URL url1 = null;
            try {
                url1 = new URL("http://192.168.0.1/sp/t1.png");
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }        ImageIcon icon = new ImageIcon(url1);
            Image blogoImage = icon.getImage();
            int iW = blogoImage.getWidth(null);
            System.out.println("iW = " + iW);
        }
    }这样解决一下试试