http://coldfusion.com logo
#cfml-general
Title
# cfml-general
j

Jason Ryan

05/04/2022, 9:05 PM
I just dropped a .JAR file in
/opt/lucee/server/lucee-server/context/lib/
and I'm at a loss for how I access it with
createObject("java","????")
. I see the Lucee docs say it "should have package path as well as package name". I know that per the Java documentation, in its native language it would be imported by this package name
com.healthx.smartonfhir
but that doesn't seem to be found by Lucee. I've tried a lot of things but having no luck.
b

bdw429s

05/04/2022, 9:08 PM
@Jason Ryan I'm not familiar with that directory, but it's not where I'd recommend putting the jars. I'd use
this.javaSettings
in your
Application.cfc
to load them
Or
app.libDirs
if you're using CommandBox and have a
server.json
As afar as whatever package/class you're trying to create, I've no clue, lol. That's for you to decide.
I'm trying to Google for whatever library you're using and I'm finding nothing
j

Jason Ryan

05/04/2022, 9:11 PM
I'm using the
lucee/lucee:5.3.8.206-nginx
docker image, and that was the only folder I could find to put a .JAR without it complaining on build. Sweet I'll check out
this.javasettings
b

bdw429s

05/04/2022, 9:13 PM
So, for example, this creating an instance of this class https://github.com/HealthLX/smart-on-fhir/blob/develop/core/src/main/java/com/healthlx/smartonfhir/core/SmartOnFhirAccessTokenResponseClient.java would be
Copy code
createOBject( 'java', 'com.healthlx.smartonfhir.core.SmartOnFhirAccessTokenResponseClient' )
That said, it appears to expect to be used inside of a Spring Framework so I'm not sure how if it is meant to just work as a stand alone lib
j

Jason Ryan

05/04/2022, 9:15 PM
That example is so helpful, thanks 😄 Yeah, never really touched Java so that Spring Framework dependency was a whole other can of worms I wasn't sure about.
b

bdw429s

05/04/2022, 9:20 PM
To be honest, if it has a hard dependency on Spring, it's probably not going to work for you
f

foundeo

05/05/2022, 12:35 AM
This guide has some tips you might find helpful: https://cfdocs.org/java look for static methods as entry points, etc