Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Remove the <code>/src</code> from your path. Assuming <code>src</code> is on your build path (in your IDE), then the compiled code will contain only the folders inside it directly at the root. For example,</p> <pre><code>/src /main/resources file.txt </code></pre> <p>will produce </p> <pre><code>/main/resources/file.txt </code></pre> <p>Now if <code>/src/main/resources</code> in on the buildpath, you need to remove the whole thing and the file will appear on the root. Its <code>InputStream</code> would be accessible as </p> <pre><code>InputStream in = this.getClass().getResourceAsStream("/&lt;folder name here&gt;/&lt;file name here&gt;.txt"); </code></pre> <p>Example</p> <pre><code>/src/main/resources // buildpath /spring applicationContext.xml /src/main/java // buildpath /mypackage MyClass.java </code></pre> <p>would be accessible like</p> <pre><code>InputStream in = this.getClass().getResourceAsStream("/spring/applicationContext.xml"); </code></pre> <p>which means the jar (if that's how you compiled and packaged it) would be structured as</p> <pre><code>/spring applicationContext.xml /mypackage MyClass.class </code></pre> <p>The method <code>getResourceAsStream(String)</code> <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getResourceAsStream%28java.lang.String%29" rel="nofollow">javadoc</a> says:</p> <blockquote> <ul> <li>If the name begins with a '/' ('\u002f'), then the absolute name of the resource is the portion of the name following the '/'. </li> <li>Otherwise, the absolute name is of the following form:<br> modified_package_name/name </li> </ul> <p>Where the modified_package_name is the package name of this object with '/' substituted for '.' ('\u002e').</p> </blockquote>
    singulars
    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