Is there any way to add resources to a class or package in java? For example, if I use JFileChooser
to give user an option to choose any image file. Let's say user has already selected a file from his desktop(or any other directory). I know that I can get it's location by calling method getSelectedFile().toString()
and it will return me directory of file in String format.
So now my desired operation is that I want to add this file into the resources of class. I want to add because I want to retrieve this image/file later by calling this.class.getResource()
method.
Please guide me, Thanks.