简体   繁体   中英

Java 7 ImageIO can fail to read and write in Windows 7 due to permissions problems

I had a program running in Windows 7 64 bit using Java 6 which fails using Java 7. ImageIO it seems makes temporary cache files when reading and writing. In my Eclipse IDE, ImageIO now hangs with no error messsage. In another machine, I get an IOException permission denied.

The workaround I've adopted is to read the image using Toolkit.createImage and convert to a BufferedImage. This doesn't seem to need to create any files but is clunky. I am now writing by converting to a byte array.

Is anyone else having these problems?

I had a performance problem with those cached files and solved it by calling javax.imageio.ImageIO.setUseCache(false) . As long as the original image files are already on a disk already, there shouldn't be a performance penalty.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM