Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Do not rely on the current directory to read files that come with the application. Instead, use <a href="http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)" rel="nofollow noreferrer">ClassLoader.getResource()</a> (to access file relative to the classpath) or <a href="http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getResource(java.lang.String)" rel="nofollow noreferrer">Class.getResouce()</a> to access files inside packages.</p> <p><strong>Edit:</strong> The above is only good for readonly access. Files that will be modified should be stored in the user's home directory (System property <code>user.home</code>), not the application directory, because the latter causes many problems:</p> <ul> <li>multiple users running the application at the same time might overwrite each other's changes </li> <li>Users cannot backup or migrate their data easily</li> <li>It is incompatible with a properly secure system of user privileges, where normal users do not have write access to application directories to prevent viruses from infecting applications.</li> </ul> <p>For small amounts of data, you can use the <a href="http://java.sun.com/javase/6/docs/api/java/util/prefs/package-frame.html" rel="nofollow noreferrer">Java preferences API</a>.</p> <p><strong>Edit2</strong>: For that particular requirement, this should work (needs the file to be in the classpath):</p> <pre><code>Document doc = docBuilder.parse ( new File(getClass().getClassLoader().getResource("webservices.xml").toURI());); </code></pre>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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