Recently, I want to use a web page to display lucene search results. I can use php and javabridge on the internet. However, I can't use the example in javabridge or the class I wrote myself. Apache2.2 + php5 + mysql can now call java's own classes such as java. lang. String, but it cannot be written by yourself... In addition, javabrid has a question about how php calls lucene (JAVA) code.
Recently, I want to use a web page to display Lucene search results. Php and javabridge can be used online. However, I cannot use example in javabridge or my own classes.
Apache2.2 + php5 + mysql
Currently, you can call java classes such as java. lang. String, but you cannot write it yourself... In addition, an example in javabridge is as follows:
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::type("Store")->YES, Lucene\document\Field::type("Index")->UN_TOKENIZED)); $writer->addDocument($doc); }................................................
But the output is
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_nekudoim IM or ';' in C: \ AppServ \ www \ test. php on line 5
It seems that php does not use this usage ...?
If java_require ("lucene. jar") is used, then java_require is not supported...
Let's pass by and help you... Thank you.
------ Solution --------------------
Your php version is too low to support namespaces
------ Solution --------------------
Is the environment configured...
Compile a simple php test...
$ Str = new java ("java. lang. String", "hello ");
Echo $ str;
------ Solution --------------------
It seems that I have encountered this problem, but it has not been solved yet.
------ Solution --------------------
Do you need to fill the water upstairs? I have met and haven't solved it yet!
------ Solution --------------------
Write a helloworld package into jar and put it in JavaBridge/WEB-INF/lib/restart jdk
Then in php, $ helloworld = new Java ("helloworld"); try it.
I have no problem.