HOWTO: Using a Java Class with Active Server PagesID: Q167941
|
This article demonstrates how one can use a Java class as an ActiveX server side object with Microsoft Active Server Pages (ASP).
The following steps show how to use a Java Server Object with ASP:
// SIMPLE.JAVA-------------
public class Simple
{
public int SimpleFn ( int x )
{
return x * 2;
}
}
jvc simple.java
NOTE: This does not require that you use the Microsoft compiler for
Java, JAVAC works just fine.
copy simple.class \winnt\java\trustlib
javareg /register /class:Simple /progid:Simple
The /class: argument is the name of the .class file in your trustlib or
lib directory. The /progid: is the name that you will use in
CreateObject() to create your COM object.
SIMPLE.ASP-------------
<html><body>
<h1>Simple Test</
h1>
The result from SIMPLE is:
<% Set SimpleObj = Server.CreateObject("Simple") %>
<% = SimpleObj.SimpleFn(5) %>
<hr>
</body></html>
------------------------
For additional information on how to find the latest Microsoft VM, please see the following article in the Microsoft Knowledge Base:
Q163637 Availability of Current Build of Microsoft VMAdditional information and Active Server Pages samples can be found at
http://msdn.microsoft.com/workshop/server/default.aspFor the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/
http://support.microsoft.com/support/java/
Additional query words: ASP java server com CreateObject
Keywords : JCOM
Version : 1.0 1.1
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 27, 1999