Operating conditions
Microsoft Java VM
Java Editor (vj++ or Microsoft Java Editor)
ASP install and run
Introduced
The MS Java Virtual machine automatically treats the public method of a Java class as a method of a COM object.
Care must be taken to do some of the necessary data type conversions (for example, to convert a Java String to BSTR ' s).
This allows you to quickly build a basic COM component and run it.
Example
public class JavaCOM
{
Public String Szhello = "Hello World";
Public String Anyfunc ()
{
String n = "as returned by Anyfunc!";
return n;
}
}
Compile this class file with Visual J + + or the MS SDK (JVC Javacom.java).
Copies the. class file of the output to the/winnt/java/trustlib directory.
Below, register the class as a COM object
Javareg/register/class:javacom/progid:javacom.test
Now, we can use a Java class like a COM object using the following statement:
Set JC = Server.CreateObject ("Javacom.test")
Response.Write Jc.szhello & "<BR>"
Response.Write Jc.anyfunc & "<BR>"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.