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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -