Using Java Classes from ASP
COM components aren ' t the only way to use compiled code in your ASP applications. If ' re familiar with
Java, but have no way of wrapping your classes as COM objects (for example, to use JDK or J + + Standard),
You can still with Java from ASP. And here ' s how
Sure you have access to the C:\<windir>\java\trustlib\ directory on your production server.
Most shared Hosting plans wouldn ' t allow this kind to access, but if you ' re developing an intranet, or a
Site for dedicated server deployment, "ll be just dandy."
Next step, compile your Java class as your would compile an applet or console class, using your favourite
compiler, any one would do, and remember to jot down the names of the public methods and properties your
Class makes available.
Drop your class file into the \trustlib\ folder, and make sure to you have a recent Java Virtual Machine
Installed on the server. The latest MS version is here.
Now to call the class from your ASP pages and use the following syntax
Set myjavaobject = GetObject ("Java:classname")
So if you compiled your class as ' Foobar.class ', your use
Set myjavaobject = GetObject ("Java:foobar")
Generally, the performance of a Java class used like this is slightly slower than a COM DLL, but faster
than just scripting, and you also have easy access to the inbuilt Java class libraries, some of which
You'll find VERY useful in your ASP apps.
Finally, call methods of the "object as you would" call methods of any other COM component