Gene R
Gene R

Reputation: 1565

Calling a .jar from ColdFusion

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?

Upvotes: 8

Views: 12052

Answers (2)

Adam Tuttle
Adam Tuttle

Reputation: 19804

Have you considered using JavaLoader?

Upvotes: 5

Tomalak
Tomalak

Reputation: 338118

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.

Upvotes: 4

Related Questions