Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is what I have found and it worked for me. The help provided by @BalusC worked for me. I have collated what I have found and how I have verified that it is working.</p> <p>I have got a maven project with following structure as shown below </p> <p><img src="https://i.stack.imgur.com/xGI49.jpg" alt="project structure"></p> <p>Now when I build this project; the jar looks like </p> <p><img src="https://i.stack.imgur.com/7VmeG.jpg" alt="enter image description here"></p> <p>and here <strong>queries.properties</strong> moves under "META-INF" folder. Now if this jar has a class which is trying to utilize this property file using <code>Thread.currentThread().getContextClassLoader().getResourceAsStream("queries.properties")</code></p> <p>thinking that the same file can still be accessed under resources folder as shown in project structure, that is wrong. The correct way is to access via META-INF folder</p> <pre><code>ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream is = classLoader.getResourceAsStream("META-INF/queries.properties"); </code></pre> <p><strong>How did I verified</strong></p> <p>Just create a simple java project and include the jar you have just created into its build path and create an instance of class which is having ClassLoader statements as mentioned above. Your code in this new java project should look like </p> <pre><code>public static void main(String[] args){ new Queries(); } </code></pre> <p>where <code>Queries</code> is a class in jar you have just included in your build path.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload