Where to place and how to read configuration resource files in servlet based application?

In my web application I have to send email to set of predefined users like [email protected], so I wish to add that to a .properties file and access it when required. Is this a correct procedure, if so then where should I place this file? I am using Netbeans IDE which is having two separate … Read more

getResourceAsStream returns null

I’m loading a text file from within a package in a compiled JAR of my Java project. The relevant directory structure is as follows: /src/initialization/Lifepaths.txt My code loads a file by calling Class::getResourceAsStream to return a InputStream. public class Lifepaths { public static void execute() { System.out.println(Lifepaths.class.getClass(). getResourceAsStream(“/initialization/Lifepaths.txt”)); } private Lifepaths() {} //This is temporary; … Read more

What is the JSF resource library for and how should it be used?

The JSF <h:outputStylesheet>, <h:outputScript> and <h:graphicImage> components have a library attribute. What is this and how should this be used? There are a lot of examples on the web which use it as follows with the common content/file type css, js and img (or image) as library name depending on the tag used: <h:outputStylesheet library=”css” … Read more

Utils to read resource text file to String (Java) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 2 years ago. The community reviewed whether to reopen this question 8 months ago and left it closed: Original close reason(s) were not resolved Improve … Read more

Add floating point value to android resources/values

I’m trying to add a little space between lines to my TextViews using android:lineSpacingMultiplier from the documentation: Extra spacing between lines of text, as a multiplier. Must be a floating point value, such as “1.2”. As I’m using this in a few different TextViews I would like to add a global dimension/value to my resources, … Read more

Get a list of resources from classpath directory

I am looking for a way to get a list of all resource names from a given classpath directory, something like a method List<String> getResourceNames (String directoryName). For example, given a classpath directory x/y/z containing files a.html, b.html, c.html and a subdirectory d, getResourceNames(“x/y/z”) should return a List<String> containing the following strings:[‘a.html’, ‘b.html’, ‘c.html’, ‘d’]. … Read more