Search Results

Search found 1 results on 1 pages for 'chimeara'.

Page 1/1 | 1 

  • Referencing java resource files for cold fusion

    - by Chimeara
    I am using a .Jar file containing a .properties file in my CF code, however it seems unable to find the .properties file when run from CF. My java code is: String key =""; String value =""; try { File file = new File("src/test.properties"); FileInputStream fileInput = new FileInputStream(file); Properties properties = new Properties(); properties.load(fileInput); fileInput.close(); Enumeration enuKeys = properties.keys(); while (enuKeys.hasMoreElements()) { key = (String) enuKeys.nextElement(); value = properties.getProperty(key); //System.out.println(key + ": " + value); } } catch (FileNotFoundException e) { e.printStackTrace(); key ="error"; } catch (IOException e) { e.printStackTrace(); key ="error"; } return(key + ": " + value); I have my test.properties file in the project src folder, and make sure it is selected when compiling, when run from eclipse it gives the expected key and value, however when run from CF I get the caught errors. My CF code is simply: propTest = CreateObject("java","package.class"); testResults = propTest.main2(); Is there a special way to reference the .properties file so CF can access it, or do I need to include the file outside the .jar somewhere?

    Read the article

1