• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

System properties (separator) in a web application

 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is this web application. I am currently working on setting up the development environment for the same.
I encounter the following problem.

1. At certain stage during the application start-up, the app reads some HTML template file.
2. To do this, it opens the "resource as a stream".
3. Directory path is being read from the configuration file.
4. File name is then appended to the path, after concatenating the "java.io.File.separator" character.
5. Once we do this, the returned value (path) ishaving the following problem

Should have been: \WEB-INF\pages\templates\en\file.html
Is now looking as : \WEB-INF\pages\templates\en/file.html -- value returned after appending the separator.

Obviously, this results in a NullPointerException. According to the Java API spec, java.io.File this is the value of a system property. However, System.setProperty() did not work.

Is there any way I can modify the system property to change the separator? Please let me know, if there's any other way to solve the problem. Thanks in advance!
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought resources were supposed to be on the classpath--why not just open it as a file if it's not on the classpath?
 
Could you hold this kitten for a sec? I need to adjust this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic