Link to home
Start Free TrialLog in
Avatar of edwardlts
edwardlts

asked on

Calling Java Class in ColdFusion

here is my java code:
public class JavSq {
     public static int squar()
     {
          int result;
          result = 5 * 5;
          return result;    
     }
}
here is my coldfusion code:

<CFOBJECT ACTION="Create"
     TYPE="Java"
     CLASS="JavaSq"
     NAME="myJava">

     <CFSET myResult = myJava.squar()>
     <CFOUTPUT>Result is #myResult#
     </CFOUTPUT>

when i run the cfm file i encounter this error:
"
The JVM library could not be found. Please check if the file specified in the ColdFusion Administrator actually exists.

The error occurred while processing an element with a general identifier of (CFOBJECT), occupying document position (8:1) to (11:15)."

I've installed jdk1.2.1 at the server and also specified the jvm lib path. i copied my class file to the class path specified at the CFadmin.
Please advice me on the problem. Thank you
ASKER CERTIFIED SOLUTION
Avatar of jimmy282
jimmy282
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of edwardlts
edwardlts

ASKER

Thanks mate. It really helps
I set up my coldfusion server according to what you said. it is still not working. can you explain more about it? i got trouble in setting up my cfobject.
bylaker
what problem u face?