0

My project was executing fine until I try to create a jar with it... From this class /TS_Generic_Engine/auto_engine_class/Resources.java I am parsing this xml file: /TS_Generic_Engine/resources/values/strings.xml

String stringFilename = "resources/values" + langId + "/strings.xml"; 
InputStream fXmlFileStream = getClass().getResourceAsStream("../" + stringFilename);

    if ( fXmlFileStream == null ) {
        if (language == RESOURCE_LANGUAGE.LANG_DEFAULT) {
            System.out.println("WARNING: No default strings resource found. Expected: " + stringFilename);
        }
        return null;
    }

Works fine, but when I export my project in a jar I get 'Exported with compile warnings' for most of my java files..

When I try to run this jar, there is this output:

WARNING: No default strings resource found. Expected: resources/values/strings.xml
WARNING: Resources have not been initialized.
WARNING: Resources have not been initialized.
WARNING: Resources have not been initialized.
Exception occurred during playback of script [UserControlScript] [CRFCN0019E: RationalTestScriptException on line 56 of script UserControlScript - java.lang.NullPointerException: null.].

If I unzip my jar, locations of files are MyJar.zip/resources/values/string.xml and MyJar.zip/auto_engine_class/Resources.java.

Melodie Gauthier
  • 685
  • 3
  • 12
  • 35

1 Answers1

0

The answer from Zubzub worked for me

Java InputStream fails to read file from within JAR

Melodie Gauthier
  • 685
  • 3
  • 12
  • 35