Questions about calling Lucene (JAVA) code in PHP

Source: Internet
Author: User
Tags parse error
Questions about calling Lucene (JAVA) code in PHP
Recently want to use the Web page to display the results of Lucene search, the web said with PHP and Javabridge can, but I use the javabridge inside the example or the class I wrote.
Apache2.2+php5+mysql
Now it is possible to call Java's own class, such as java.lang.String, but I can't write it ... And there's an example of this in Javabridge:
PHP Code
  
  Listfiles ();  ASSERT (!java_is_null ($files));    foreach ($files as $f) {$doc = new lucene\document\document (); $doc->add (New Lucene\document\field ("name", $f->getname (), lucene\document\field::t    Ype ("Store")->yes, Lucene\document\field::type ("Index")->un_tokenized));  $writer->adddocument ($doc); }................................................

But the output is this
warning:unexpected character in input: ' \ ' (ascii=92) state=0 in C:\AppServ\www\test.php on line 5

Parse error:syntax error, unexpected t_string, expecting t_as or T_paamayim_nekudotayim or '; ' in C:\AppServ\www\test.php On line 5
It seems that PHP does not use this usage ah ...?
If Use Java_require ("Lucene.jar"), say Java_require what does not support ...
Let's go and help. Thank you.

------Solution--------------------
Your PHP version is too low and does not yet support namespaces

------Solution--------------------
Environment is configured well ...
Write a simple PHP test ...
$STR = new Java ("java.lang.String", "Hello");
Echo $str;
------Solution--------------------
It's like I've met this question, but it's not solved yet.
------Solution--------------------
Upstairs is not irrigation ah, still make a seem to have met? I've really met, and it's not settled yet!
------Solution--------------------
Write yourself a HelloWorld and pack it into jars and put it under javabridge/web-inf/lib/to restart the next JDK.

Then in PHP $helloworld =new Java ("HelloWorld"); Try

I have no problem with this.
  • 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.