Last active
December 14, 2023 09:58
-
-
Save stevewithington/94daf471d55063249958 to your computer and use it in GitHub Desktop.
Mura CMS : JavaSettings LoadPaths example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
/* | |
Assuming you have downloaded and extracted the OpenCSV project from http://opencsv.sourceforge.net | |
you will then need to grab the file from /deploy/opencsv-2.x.jar file, and add it to one of your | |
registered javaSettingsLoadPaths directories. | |
You _may_ have to restart CF for the libraries to get registered. | |
*/ | |
// full filesystem path to the file | |
csvFile = ExpandPath('#$.siteConfig('themeAssetPath')#/assets/files/sample.csv'); | |
// container | |
csvData = []; | |
// FileReader | |
fileReader = CreateObject('java','java.io.FileReader'); | |
fileReader.init(csvFile); | |
// ** This is the magic! ** | |
// CF will scan your registered libs for you to load your object (OpenCSV) | |
csvReader = CreateObject('java','au.com.bytecode.opencsv.CSVReader'); | |
csvReader.init(fileReader); | |
// the data | |
csvData = csvReader.readAll(); | |
// release system resources | |
csvReader.close(); | |
fileReader.close(); | |
WriteDump(var=csvData); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; add this to your /config/settings.ini.cfm | |
; it's just a comma-separated list of paths to your Java libraries | |
; but only _if_ you want to use something other than /requirements/lib | |
javaSettingsLoadPaths=/requirements/lib,/default/includes/themes/MuraBootstrap3/lib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment