Using Java classes in ASP (using Java Classes from ASP)

Source: Internet
Author: User
Tags dedicated server shared hosting
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



Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.