How to get a file from ressource
<p>I know it seems like my question has been answered before, but I can't find an answer for my case.</p>

<p>What I am trying to do, is to get a File type from resource, so when it's packaged, it can be accessed. The answers I found were trying to read that file, but what I really need, is to construct a File object, because I have a third party library that is expecting that object.</p>

<p>Here is a the code I tried:</p>

<pre><code>    String xslFilePath = new Test().getClass().getResource("/com/test/decision_template.xsl").getPath();
    System.out.println(xslFilePath);
    File xsltfile = new File(xslFilePath);
    System.out.println(xsltfile.getAbsolutePath()+", exist:"+xsltfile.exists());
</code></pre>

<p>I got this result:</p>

<pre><code>    C:\&gt;java -jar test.jar
    file:/C:/test.jar!/com/test/decision_template.xsl
    C:\\file:\C:\test.jar!\com\test\decision_template.xsl, exist:false
    java.io.FileNotFoundException: file:\C:\test.jar!\com\test\decision_template.xsl
    (Syntaxe du nom de fichier, de rÚpertoire ou de volume incorrecte)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:120)
    at com.test.Test.main(Test.java:30)
</code></pre>

<p>I need a way to get that file so the .exists() return true.</p>
