I need to create an instance of org.apache.camel.guice.Main in my application. For reasons I don't want to get into, I cannot package a jndi.properties file in my jar/bundle, which will be used by org.apache.camel.guice.Main.run() to bootstrap the app. I also cannot write anything to the file system.
I do have the properties that would normally go into jndi.properties available at runtime as a java object, map of strings, whatver. Can I write these out to a "dynamic" jndi.properties and put it on the classpath (or add it to a classloader as a "resource")? Something like:
this.getClass().putResourceAsStream(properties);
So that 3rd party frameworks that do need to load via getResource() or getResourceAsStream() can do it?
I was able to get this to work by doing 4 things:
Big thanks to Thorbjorn Andersen in the comments, that made me go back and take a closer look at the InitialContext api.