I f you want to try the jar method, here's a quicky on how to
jar up your file as a package.
in a work folder, create a folder structure for your package,
convention uses reverse internet domain (i.e.
com.adobe.packagename)
for this one, we'll use a simple one level package called
ironyx. So create a folder called ironyx.
copy the java file you want to package up into the ironyx
folder
at the top of the java file place the following;
package ironyx;
Compile the java file.
Using a command prompt in the parent folder of the ironyx
folder, type the following;
jar -cf ironyx.jar ironyx
This will jar up the ironyx folder contents, including both
the java and class files into an ironyx.jar file. You can delete
the source java files prior to creation of the jar file if you
wish.
Copy the jar file to ColdFusion WEB-INF\lib directory, bounce
the cf instance
A typical cf execution might look like
<cfset mySimpleMath=
CreateObject("java","ironyx.SimpleMath")>
<!--- Usually you Initialize the object, but that depends
on the constructors of the class--->
<cfset mySimpleMath.init()>
<!--- Execute the method --->
<cfset result = mySimpleMath.addNumbers(num1, num2)>
Note: If you're using the SimpleMath class file from
http://builder.com.com/5100-6370-5177283.html,
they have a text formatting error for the method. There should be
spaces in publicintaddNumbers and it should look like
public int addNumbers