TRIRIGA

 View Only
  • 1.  Loading resource files in Custom Class Loader

    Posted 6 days ago

    Greetings,
    I'm trying to write a custom Class Loader that will be deployed as a Resource File. I wish to load a properties file will be stored in another Resource File record. I followed the directions here: https://www.ibm.com/docs/en/tap/4.4?topic=functions-adding-resource-files-class-loaders

    How do I write the Java code to access the properties file? For example TRIRIGAIntegration.jar has code that loads the files stored in TRIRIGAIntegration_Assets.zip. How is the Java code in TRIRIGAIntegration.jar written to access those files?



    ------------------------------
    Emerson David
    ------------------------------


  • 2.  RE: Loading resource files in Custom Class Loader

    Posted 6 hours ago
    Edited by Edwin Premkumar David 6 hours ago

    Hello - 

    Try below code to load the property file at the same level which is defined as a resource in the same class loader. 

    Properties properties = new Properties();
    properties.load(getClass().getClassLoader().getResourceAsStream("<YOUR_PROP_FILE>.properties"));



    ------------------------------
    Edwin Premkumar David
    ------------------------------