user1340802
user1340802

Reputation: 1157

Adding custom analyzer to Luke

This question was already asked here on Stack Overflow, BTW even after reading the answer provided, I do not manage to add MyOwnAnalyzer, so that I can use it directly from Luke.

Please can someone help me on the right way to do, that is how and what to do so that MyOwnAnalyzer can be usable directly from Luke?

Can I do this (it did not work, may be my included jar are incomplete?):

java -cp .;d:\java\mylibs\MyOwnAnalyzer.jar -jar lukeall-3.5.0.jar

(MyOwnAnalyzer.jar was built from Eclipse and contains : MyOwnAnalyzer.java, MyOwnTokenizer.java, and MyOwnToken.java inside a subdirectory com.MyCompany... Eclipse added META-INF and manifest.mf for me)

Maybe I am wrong in adding classpath and MyOwnAnalyzer.jar with my command line?

Or must I build Luke from source including MyOwnAnalyzer somewhere in its directory?

Or is there something else to include/write so that my analyzer can be usable and imported from Luke? (looks like there is a mechanism to detect all classes that subclasses Analyzer - MyOwnAnalyzer is already declared as "extends Analyzer" )

BTW, even if it not really the same question but still in the same topic of using a custom analyzer from Luke... si I have an Error when using the tab Analyzer Tool I get Error analyzing:com/google/common/io/CharStreams , this lib is included in a jar, where I included a main that do a sample analysis to check and everything work fine when using it alone. If I use it as explained by JPountz, from Luke, I can see MyOwnAnalyzer from all the Luke tabs, but it did not work!

from the Luke code source, I think what throw the exception this is located somewhere inside the method analyze.

Note: The call to CharStreams.toString(input); is to transform the Reader input to a String inside MyOwnTokenizer.

Upvotes: 2

Views: 1063

Answers (1)

jpountz
jpountz

Reputation: 9964

Java ignores the -cp option when the -jar option is also used. You need to run Luke this way:

java -cp lukeall-3.5.0.jar;MyOwnAnalyzer.jar org.getopt.luke.Luke

Upvotes: 4

Related Questions