Where To ?

Home Page

Components
NTAccess.User
NTAccess.Groups
NTAccess.RAS
NTAccess.Permissions
NTAccess.Performance
Zaks.POP3
Zaks.Directory
Zaks.URLBuilder
Zaks.Trace
Zaks.Collection
Zaks.Shares

Documents
Configuration FAQ
Java-COM for ASP
Useful Links


Add To Channels
Microsoft Internet Explorer
Add To Desktop
Java-COM Components for ASP

Introduction
In what will hopefully be a series of articles, i'll show you how to take full advantage of Java as a language for building ASP Components.

What You'll Need
  • An update copy of the Microsoft Java VM (Normally installed with IE4)
  • A Java compiler (either VJ++ or the Microsoft Java compiler in the SDK)
  • ASP Installed and working
Getting Started
The MS Java VM automatically exposes public methods of a Java class as COM Methods. Where necessary it will do basic data type conversion (i.e. converts Java Strings to BSTR's). This allows you to very quickly get a basic COM Component up and running.

Example
public class javaCOM
{
    public String szHello = "Hello World" ;
    public String anyFunc()
    {
        String n = "As returned by anyFunc !" ;
        return n ;
    }
}

Compile the class using either VJ++, or the MS SDK ( jvc javaCOM.java ). This will output a .class file javaCOM.class which needs copying to the /winnt/java/trustlib directory.
Now we need to register the class as a COM Object, remembering that java IS case sensitive.
	javareg /register /class:javaCOM /progid:javaCOM.Test
Thats it !!, now we have a Java class exposed as a COM Object, to use from ASP, do
	set jc = Server.CreateObject("javaCOM.Test")
	response.write jc.szHello & "<BR>"
	response.write jc.anyFunc & "<BR>"		

Last Updated : Saturday, October 17, 1998
(C) 1997 - 1999 Simon Fell, All rights reserved