Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (798)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (865)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Create Image files  (Read 1618 times)
0 Members and 1 Guest are viewing this topic.
Offline AppleSauce
« Posted 2014-06-09 18:56:23 »

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.
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1 - Posted 2014-06-09 18:59:15 »

Not entirely sure what you're trying to do, but give ImageIO a look.
Offline AppleSauce
« Reply #2 - Posted 2014-06-09 19:18:44 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #3 - Posted 2014-06-09 19:26:28 »

java.nio.Files


1  
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.
Offline AppleSauce
« Reply #4 - Posted 2014-06-09 20:21:17 »

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

1  
2  
3  
4  
5  
6  
7  
8  
9  
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)
Offline AppleSauce
« Reply #5 - Posted 2014-06-10 01:17:05 »

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!
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (33 views)
2019-09-04 15:33:17

hadezbladez (3979 views)
2018-11-16 13:46:03

hadezbladez (1444 views)
2018-11-16 13:41:33

hadezbladez (3978 views)
2018-11-16 13:35:35

hadezbladez (768 views)
2018-11-16 13:32:03

EgonOlsen (4083 views)
2018-06-10 19:43:48

EgonOlsen (4655 views)
2018-06-10 19:43:44

EgonOlsen (2752 views)
2018-06-10 19:43:20

DesertCoockie (3646 views)
2018-05-13 18:23:11

nelsongames (3840 views)
2018-04-24 18:15:36
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!