Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can anyone explain getResource()?

640063Jun 27 2008 — edited Jun 27 2008
I can't find this info in any documentation I read. I have a servlet on tomcat under tomcat-home/webapps/ROOT/WEB-INF/classes/package/Upload.class. When I use (new Object()).getClass().getResource("/filename.ext") to get the url to a file, I always get null. Where am I supposed to put "filename" so it can be found? I've tried, ROOT/, ROOT/WEB-INF/, ROOT/WEB-INF/classes, and ROOT/WEB-INF/classes/package/. I always get null.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 25 2008
Added on Jun 27 2008
4 comments
423 views