Hi,

I have the following code in my java application:

Code:
try {
       //Load system configuration
       tempPath = getClass().getClassLoader().getResource("config/system_config.xml").toURI().getSchemeSpecificPart();
} catch (URISyntaxException ex) {
       Logger.getLogger(MainUI.class.getName()).log(Level.SEVERE, null, ex);
}
systemConfigFile = new File(tempPath);

dbFactory = DocumentBuilderFactory.newInstance();
dBuilder = null;
try {
       dBuilder = dbFactory.newDocumentBuilder();
} catch (ParserConfigurationException ex) {
       errors++;
       errorReason = "<html>Could not load System Configuration File <br><span style=\"font-size:10px\">"+systemConfigFile.getPath()+"</span></html>";
}

if(errors == 0) {
       systemConfig = null;

       try {
              systemConfig = dBuilder.parse(systemConfigFile.getPath());
              systemConfig.getDocumentElement().normalize();
       } catch (SAXException | IOException ex) {
              errors++;
              errorReason = "<html>Could not parse System Configuration File <br><span style=\"font-size:10px\">"+systemConfigFile.getPath()+"</span></html>";
       }
}
And this all works fine when using Netbeans, but once I build the project and try to open the .jar file, I get the error:
Code:
errorReason = "<html>Could not parse System Configuration File <br><span style=\"font-size:10px\">"+systemConfigFile.getPath()+"</span></html>";
This error is printed onto a label on my form, and the address that goes with it is:
Code:
file:\G:\Java\TestXML\dist\TestXML.jar!\config\system_config.xml
When I extract the .jar, the xml file is exactly where it should be.

How can I build my JAR file to avoid this error?

Cheers.
Sephers