Saving web images as assets

I’m making a particular game where sometimes, the game will have to access images on a web page for use in gameplay. I’m currently using Jsoup to access the images, and it’s working (I get them as java.awt.image.BufferedImages), but I have no idea how to save it to the assets directory for future games.



I also can’t find out how to convert BufferedImages to jme Textures, but solving the first problem will make this possible through the AssetManager.

To clarify, I want to be able to save those images to the client’s asset folder. I would normally do this by finding the class loader, but I’m not sure how JME and its asset folders work, especially on a client machine. If someone could give me a dummy’s guide to saving a BufferedImage to one of the asset folders, I would be grateful.

Have a specified folder, like

System.getProperty(“user.dir”)+"/mygamename/"

Game sets up a Filelocator at start to this folder.

Get the url and download it to a specified folder. (using normal java and URL class)

Load it using its relative path like u do normally.



Depending on how you distribute your game it is probaly not possible to safe direct into the asset folder.

→ When the game is running from a jar that has the assetfolder included, you cannot modify it while the jvm locked the .jar

Its outlined in the wiki.