Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
During the development process, you may encounter problems in ASP/ASP. net calls the classes written in JAVA to implement functions previously implemented in JAVA. The following is a simple example to illustrate the detailed usage:
1. Create a java file:
Use any editor you like to edit the following content:
Public class hello
Public String helloWorld (String s)
If (s = null)
Save this file as hello. java
2. Compile the java file as a class:
Run in command mode: javac hello. java
3. Copy the compiled hello. class file to the c: winntjavarustlib directory.
4. Create the following file named test. asp:
Set javaObject = GetObject ("java: hello ")
Msg = javaObject. helloWorld ("Hello World ")
Set javaObject = nothing
Response. write msg
Create a virtual directory test in IIS and set test. copy the asp file to this virtual directory, restart IIS, and access http: // localhost/test in ie. asp. "Hellow World" is displayed on the page, indicating that the call is successful.
Asp.net can be used in the same way as ASP.
Note: In step 2, the 1.3.x compiler must be used for compiling. Although the compilation is normal in jdk 1.4, the No object for moniker error is displayed when I call asp/asp.net.
6. If other jar packages are imported to the java file, you need to add these packages in step 3. copy the jar file to the c: winntjavapackages directory, and add the classpath variable in my computer --> properties --> advanced --> System variables, the value is the detailed path of the cited jar file, such as c: winntjavapackagesldapfilt. jar; c: winntjavapackagesldapjdk. jar; c: winntjavapackagesldapsp. jar ;. separated by semicolons and ended with decimal points
The test passed in both Chinese and English win2000 and winXP
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.