java open file from classpath with a space character in it -
i have webapp hosted in tomcat, , jenkins build server. i've read best way read file bundled jar, use classpath rather hardcoded fullpath.
i see variant of recommended way:
this.getclass().getresourceasstream("/testfile.txt");
and seems work locally, on jenkins linux build server, setup build in directory containing space, getresourceasstream() fail because internally fails lookup file, since path contains contains space, gets translated %20.
thus, see 2 possibilities, either:
- everyone suggesting use getresourceasstream() wrong, , robust use handles paths spaces in it, need more before calling getresourceasstream()
- the getresourceasstream contains bug
i guess first option, question is, what's correct way handle this?
Comments
Post a Comment