I am a novice at Java development in Domino. I am having an issue accessing a file located in Res within a Java Script Library. Everything works within a Java Agent.
My Java Agent contains the following line of code:
InputStream keyStream = getClass().getClassLoader().getResourceAsStream("samplefile.json");
"keyStream" returns the contents of the "samplefile.json" file. Not NULL.
I would like to move the Java Agent code to a Java Script Library so I can call the function from a Lotusscript Agent. I am able to call the Java Script Library function however the "keyStream" is returning a NULL value. I have added the "samplefile.json" to the Java Script Library Res and the code still returns NULL.
I found variations of the Java Agent code and all return a NULL.
The following are the various lines of code I have tried:
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("Res/samplefile.json");InputStream inputStream = CLASS_NAME.class.getResourceAsStream(“Res/samplefile.json”);
InputStream inputStream = CLASS_NAME.class.getClassLoader().getResourceAsStream(“Res/samplefile.json”);
I even tried without "Res" like the Java Agent.
Any idea how I can access the "samplefile.json" located in the Java Script Library Res?