Friday, February 18, 2022

python2 virtual environment

The pip installer for python 2.7 can be found here: 

curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py

Verify that the pip2 is installed by looking for it in

$HOME/Library/Python/2.7/bin


To setup the virtual environment in Python2, use virtualenv  


Library/Python/2.7/bin/virtualenv -p $(which python2.7) venv


Activate the virtual environment


source /venv/bin/actiave


Install packages in the virtual environment


python -m pip install lxml jinja2


To exit the virtual environment 


deactivate


If you don't have virtualenv you can install using pip


python -m pip virtualenv --user

Tuesday, February 01, 2022

Installing openJDK on macOS

 If you don't have a java version requirement, and/or you want the latest version of openJDK, you can simply issue the following at the command line.


brew install openjdk 


On January 28, 2022 the latest version available was 17.  

I had a tool that required openJDK 15.  I was getting this error:

class com.oopsconsultancy.xmltask.jdk15.XPathAnalyser15 (in unnamed module @0x5c86dbc5) cannot access class com.sun.org.apache.xpath.internal.XPathAPI (in module java.xml) because module java.xml does not export com.sun.org.apache.xpath.internal to unnamed module @0x5c86dbc5


    at com.oopsconsultancy.xmltask.jdk15.XPathAnalyser15.analyse(XPathAnalyser15.java:28)....

Version 15 has been archived so, I downloaded it from the idk archive https://jdk.java.net/archive/.  

#I decompressed with the tar command:

tar -xvf openjdk-15_osx-x64_bin.tar

# Installed the JDK 

 sudo mv jdk-15.0.1.jdk /Library/Java/JavaVirtualMachines/

#Verified

/usr/libexec/java_home -V

Matching Java Virtual Machines (1):

    15 (x86_64) "Oracle Corporation" - "OpenJDK 15" /Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home

#Made it the default version

export JAVA_HOME=`/usr/libexec/java_home -v 15`


Voila!