Search code examples
pythonmacosjava-8pylucenejcc

Pylucene installation on MacOs with adoptopenjdk / Java8


I am trying to install JCC (as part of the installation of PyLucene) and I encountered several issues with it. The python version I use is 3.7, and I have installed adoptopenjdk-8.jdk using brew cask (since Java-8 is no longer available without specific license (read it somewhere)). After this didn't really worked I manually installed Java-8

The error I am receiving while trying to run setup.py in shell (using either java8 or adoptopenjdk) is:

OSError: warning: [options] bootstrap class path not set in conjunction with -source 5 
error: Source option 5 is no longer supported. Use 7 or later. 
error: Target option 5 is no longer supported. Use 7 or later.

Please help me install PyLucene!

It is related to these (but they are outdated and doesn't work):

pyLucene Installation

https://medium.com/@michaelaalcorn/how-to-use-pylucene-e2e2f540024c

EDIT: I realized this is related to javac versions but idk how to solve it. This site looks helpful (from the code) but I can't understand whats written here: https://www.jianshu.com/p/dcd149a65eb0


Solution

  • So,

    Changing the the setup.py file in 2 locations solved it:

    line 185:

    JAVAC = {
    'darwin': ['/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/bin/javac', '-source', '1.5', '-target', '1.5'],
    

    and adding one line here (line 68):

    JAVAHOME = '/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home'
    
    JDK = {
    'darwin': JAVAHOME,
    'ipod': '/usr/include/gcc',