欢迎光临
我们一直在努力

在ASP中使用Java类(Using Java Classes from ASP)

建站超值云服务器,限时71元/月

using java classes from asp

com components arent the only way to use compiled code in your asp applications. if youre familiar with

java, but have no way of wrapping your classes as com objects (for example, you use jdk or j++ standard),

you can still use java from asp. and heres how

first, make sure you have access to the c:\<windir>\java\trustlib\ directory on your production server.

most shared hosting plans wouldnt allow this kind of access, but if youre developing an intranet, or a

site for dedicated server deployment, youll be just dandy.

next step, compile your java class as you would compile an applet or console class, using your favourite

compiler, any one will 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 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, use the following syntax

set myjavaobject = getobject("java:classname")

so if you compiled your class as foobar.class, you 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

youll find very useful in your asp apps.

finally, call methods of the object as you would call methods of any other com component

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 在ASP中使用Java类(Using Java Classes from ASP)
分享到: 更多 (0)