Create Image files

I’m trying to create a folder on the desktop holding images and other data. If I have a folder with all of the images in my workspace, how would I send the files and image to a specific folder on my desktop. All the images and such are in my workspace resource folder. I know how to create folders and text files, but not how to put images into those files.

Not entirely sure what you’re trying to do, but give ImageIO a look.

I’m trying to create image files on the users’ desktop. Let’s say i have a picture of an orange in my eclipse workspace in the resource folder. When somebody downloads the project, I want to take that image of an orange and put it in a folder called fruit on their desktop.

java.nio.Files


Files.copy(getClass().getResourceAsStream("blahblahblah"), Paths.get(System.getProperty("user.home") + "/Desktop"));

Not super robust, and probably only works on Windows, but I’ll let you decide if that is good enough or not.

I tried doing that but i changed the blahbl stuff to an image in my res folder. I got this exception:

java.nio.file.AccessDeniedException: C:\Users\Owner\Desktop
	at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
	at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
	at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
	at java.nio.file.Files.newOutputStream(Files.java:216)
	at java.nio.file.Files.copy(Files.java:3013)
	at com_FlubberSpace.MainFS.main(MainFS.java:110)

nevermind this, I was trying to find a replacement because I couldn’t export and run my game. I realized(after 2 weeks) that I didn’t add the class path stuff. I heard that I needed it, but didn’t understand what that person meant. YAAAY!