How to call JavaBean in PHP4

Source: Internet
Author: User
First of all, I did not understand this article when writing this article. I just used the example from php.net and tried to do it. it was in the win2000apachephp4p12 configuration. the specific steps are as follows: 1. install JVM (javavirtualmachine) (I use jdk122). of course, you do not have to use jdk122, or even jdk: JVMKaffe1.0.4. the specific steps are as follows: 1. install JVM (java virtual machine) (I use jdk122)

Of course, you do not have to use jdk 122 or jdk, but use another one, for example:
JVM = Kaffe 1.0.4 (as delivered with OS), OS = Redhat Linux 6.1
JVM = Kaffe 1.0.5 (built from source), OS = Redhat Linux 6.1
JVM = IBM 1.1.8, OS = Redhat Linux 6.1
JVM = Blackdown 1.2.2 RC4, OS = Redhat Linux 6.1
JVM = Sun JDK 1.1.8, OS = Windows NT 4/win2000
However, here I will only talk about my practices. I have never tried other things. please do not ask me. here, please note that, according to the instructions on the official site of php, jdk122 linux is not supported.
II. set environment variables

In win2000, choose "My Computer"> "properties"> "advanced"> "environment variables"
Set JAVA_HOME
Jdk path. for example, if my jdk122 is installed in e: \ jsp \ jdk122, set it to e: \ jsp \ jdk122.

3. download related files (if you do not have one)

: Http://www.php.net/downloads.php
I downloaded the: php-4.0.1-Win32-java-jdk122.zip file. There are several examples after decompression, and there are: php_java.dll and php_java.jar files.
4. configure the php. ini file

[Java]
Java. class. path = E: \ PHP4 \ php_java.jar
Java. home = E: \ jsp \ jdk122 \ bin
Extension = php_java.dll
Java. library. path = E: \ PHP4 \ ext \
Java. library = E: \ Program Files \ kerberoft \ JRE \ 1.2 \ bin \ classic \ jvm. dll
The above is my configuration. for details, my php4 is in the e: \ php4 directory, and all my extended dll files are stored in the e: \ php4 \ ext directory, of course, php_java.dll should be copied to this directory. finally, confirm that your win2000 has jvm. dll file. if not, install visual studio (I installed VC 6, so I don't have to worry about it)
V. test

Run phpinfo () and you will see "java". if not, it indicates that you have not succeeded. it is shown as follows:

Java
Directive Local Value Master Value
Java. class. path
E: \ PHP4 \ php_java.jar E: \ PHP4 \ php_java.jar
Java. home
E: \ jsp \ jdk122 \ bin E: \ jsp \ jdk122 \ bin
Java. library
E: \ Program Files \ kerberoft \ JRE \ 1.2 \ bin \ classic \ jvm. dll jvm. dll
Java. library. path
E: \ PHP4 \ ext \ no value


VI. test example

I used the example in the downloaded file: jver. php. if it succeeds, the following results will be displayed:
Java version = 1.2.2
Java vendor = Sun Microsystems Inc.
OS = Windows NT 5.0 on x86
Wednesday, March 13, 2000 at 10:32:53 GMT

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.