> On Jul 22, 2018, at 17:12, Philippe Baril Lecavalier <pbl....@gmail.com> > wrote: > > Hi, > > I'm trying to use JCC to access Java libraries from python, as this seems > to be its stated purpose. (Any known use outside of pylucene?) > > I get that all classes are flattened by default, and in some cases > `--rename` becomes unpractical in no time. > `--use_full_names` works, but then how to use the resulting module? > > Let's translate the example there to use full names: > https://jcc.readthedocs.io/en/latest/ > > python3.6 -m jcc \ > --jar boilerpipe-1.2.0.jar \ > --classpath lib/nekohtml-1.9.13.jar \ > --classpath lib/xerces-2.9.1.jar \ > --package java.net \ > java.net.URL \ > --use_full_names \ > --python boilerpipe2 --build --install > > > import boilerpipe2 as boilerpipe > jars = ':'.join(('lib/nekohtml-1.9.13.jar', 'lib/xerces-2.9.1.jar')) > boilerpipe.initVM(boilerpipe.CLASSPATH+':'+jars) > > Now what? > findClass() sounds useful. Looking at the source it seems to work thus: > boilerpipe.findClass('java/net/URL') > > No idea past this point.
If the java class is java.net.URL, from python you can use it like this: from java.net import URL If you have the pylucene sources, take a look at its tests and samples, they have a bunch of usage examples. As for other uses than wrapping lucene, sure ! I remember wrapping tika once, a pretty long command line... Andi.. > > Thanks, > Philippe