Call JAVA in PHP

Source: Internet
Author: User
Install PHP4.3.5RC3. dev (Win32) + Apache2.0.52 (ForWin32) and j2sdk1.4 (ForWin32). if it is not installed, read the related manual. In the PHP configuration file php. find "; extension = php_java.dll" in ini, and remove the semicolon to install PHP4.3.5RC3. dev (Win32) Apache 2.0.52 (For Win32) and j2sdk 1.4 (For Win32) are Needless to say. if it is not installed, please refer to the relevant Manual.
In the PHP configuration file php. ini, locate '; extension = php_java.dll' and drop the semicolon;
Find again:
[Java]
; Java. class. path =
; Java. home =
; Java. library =
; Java. library. path =

Changed:
Java. class. path = 'Java's CLASS_PATH; (Directory of the class file to be placed) d: \ java_for_php'
Java. home = 'Java javahome'
Java. library = 'Java JAVAHOME \ jre \ bin \ server \ jvm. dll'
Java. library. path = 'php installation directory \ extensions \'

After modification, the php. ini file must be placed in the Windows installation directory to restart Apache.

Create a new PhpCallJava. java file in d: \ java_for_php with the following content:
Public class PhpCallJava {
Public String testString;

Public String test (String str ){
If (str. equals ('')){
Return 'This is a empty string! ';
} Else {
Return str;
}
}

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.