views:

1055

answers:

2

I have a .jar file that i've placed in my D:\Coldfusion8\wwwroot\web-inf\lib\ directory. The file is abcdef.jar

This is my first time doing this, not sure what the path should be in my createObject().

<cfset abcObj = createObject("java","com.abcdef") />
<cfset result = acbObj.doStuff("123456") />

But when I run it, I get Object Instantiation Exception. Class not found: com.vp4jo_b

What am I missing in the path?

+1  A: 

Have you restarted the Coldfusion Service?

Even when in the class path, jars are only loaded at server start.

Info moved up from the comments:

  • Make sure the file is in the System class path, or in the one of the configured class paths of ColdFusion.
  • As for the class name parameter of CreateObject(): The class name starts within the jar. Open it like a .zip file and look at its structure. The dotted path mimics the folder structure, so if the Server still complains, you must be missing something in the dotted path.
Tomalak
I have. My confusion comes in where the "com" starts. I got that from an example on the web. As I said, my .jar is in D:\Coldfusion8\lib\
Gene R
The "com" starts within the jar. Open it like a .zip file and look at its structure. The dotted path mimics the folder structure, so you must be missing something in the path.
Tomalak
Ok, so going back, where do I tell Coldfusion to even look for the .jar file?
Gene R
Nevermind. I had the .jar in the wrong directory. I moved it, restarted CF, followed your advice about the Path, fixed my createObject and Voila... THanks!
Gene R
good to hear - deleted my post as no longer relevant
toolkit
So I'll move that info to the answer and you can accept it.
Tomalak
+1  A: 

Have you considered using JavaLoader?

Adam Tuttle
JavaLoader is definitely the way to go. That way you can place the Java class/lib where you like rather than relying on the class path for your specific installation.
modius