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.