I am writing an upload and a download function, and I try to have this two methods to write to or read from the same folder, and I ran into some problem with getResourceAsStream
. (The software is run on glassfish)
upload: The method upload to this folder: /home/phamtn8/glassfishv3/glassfish/domains/domain1/applications/Documents/Documents-war_war/drawings/Liandro.jpg
--> work great
download: stream = the above path
input = this.getClass().getResourceAsStream(stream);
//This return null
The location of the class files that contain these upload and download methods is at:
/home/phamtn8/glassfishv3/glassfish/domains/domain1/applications/Documents/Documents-war_war/WEB-INF/classes/org/xdrawing/web
. If I put the jpg
file here, the getResourceAsStream
work.
NOTE: this.getClass.getName()
return org.xdrawing.web.FileName
Please help !!!