4

How do i call a jar file provided using CFML?

I tried using createObject() method but I am confused about the path.

Is it the class path or jar file path?

Where I have to place the .jar file?

Do I need to load the .jar file on Blue Dragon server?

Thanks,

2 Answers 2

4

In order to use custom jar files you need to copy them into specific directory in ColdFusion - a classpath. It depends on the setup but usually it's located here:

#server.ColdFusion.ROOTDIR#\lib\

Then you need to restart the CF server.

Here's some guide on doing it: http://blogs.adobe.com/cantrell/archives/2004/07/the_definitive.html

If you're planning on using more jar files it could be usefull to use some library like JavaLoader - then you can load any jar withouth the need of restarting CF.

Sign up to request clarification or add additional context in comments.

13 Comments

Just a note: to load the class using createObject() you need to know the path and class name from within the JAR. You can find this out by exploring the JAR archive using a zip program like 7Zip. You'll usually see a set of directories you need to drill down into to get to your class. This path is the path you need to use in createObject().
hi, I am using BlueDragon server with .Net architecture.I dont have lib folder in that.Where to put the jar files?
Also be aware the class name may be case sensitive. ie Under ACF this works createObject("java", "java.lang.String").init("test") this does not createObject("java", "java.lAnG.sTrInG").init("test")
@Komal - I am not familiar with BD. Did you try {app}\WEB-INF\lib?
Can BD .NET call java classes?
|
4

I suggest http://javaloader.riaforge.org/ for loading java object. It gives lots of flexibility like you do not need to store your class file in web-inf or doesn't need to map directory.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.